Browse Source

Refactored Narrative scripts to use protected fields with public property accessors

master
Christopher 8 years ago
parent
commit
9ead74d659
  1. 6
      Assets/Fungus/Lua/Scripts/LuaExtensions.cs
  2. 12
      Assets/Fungus/Narrative/Editor/CharacterEditor.cs
  3. 6
      Assets/Fungus/Narrative/Editor/LocalizationEditor.cs
  4. 98
      Assets/Fungus/Narrative/Editor/PortraitEditor.cs
  5. 28
      Assets/Fungus/Narrative/Editor/SayEditor.cs
  6. 14
      Assets/Fungus/Narrative/Editor/StageEditor.cs
  7. 40
      Assets/Fungus/Narrative/Scripts/Character.cs
  8. 2
      Assets/Fungus/Narrative/Scripts/Commands/ClearMenu.cs
  9. 26
      Assets/Fungus/Narrative/Scripts/Commands/ControlStage.cs
  10. 4
      Assets/Fungus/Narrative/Scripts/Commands/ControlWithDisplay.cs
  11. 4
      Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs
  12. 12
      Assets/Fungus/Narrative/Scripts/Commands/Menu.cs
  13. 4
      Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs
  14. 66
      Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs
  15. 44
      Assets/Fungus/Narrative/Scripts/Commands/Say.cs
  16. 2
      Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs
  17. 2
      Assets/Fungus/Narrative/Scripts/Commands/SetMenuDialog.cs
  18. 2
      Assets/Fungus/Narrative/Scripts/Commands/SetSayDialog.cs
  19. 14
      Assets/Fungus/Narrative/Scripts/ConversationManager.cs
  20. 21
      Assets/Fungus/Narrative/Scripts/CustomTag.cs
  21. 8
      Assets/Fungus/Narrative/Scripts/DialogInput.cs
  22. 13
      Assets/Fungus/Narrative/Scripts/Localization.cs
  23. 12
      Assets/Fungus/Narrative/Scripts/MenuDialog.cs
  24. 134
      Assets/Fungus/Narrative/Scripts/PortraitController.cs
  25. 43
      Assets/Fungus/Narrative/Scripts/SayDialog.cs
  26. 51
      Assets/Fungus/Narrative/Scripts/Stage.cs
  27. 390
      Assets/Tests/Localisation/LocalisationTests.unity
  28. 12
      Assets/Tests/Narrative/NarrativeTests.cs
  29. 118
      Assets/Tests/Narrative/NarrativeTests.unity
  30. 16
      Assets/Tests/Narrative/OverlapTests.cs
  31. 24
      ProjectSettings/GraphicsSettings.asset

6
Assets/Fungus/Lua/Scripts/LuaExtensions.cs

@ -26,7 +26,7 @@ namespace Fungus
}
bool addedOption = false;
foreach (Button button in menuDialog.cachedButtons)
foreach (Button button in menuDialog.CachedButtons)
{
if (!button.gameObject.activeSelf)
{
@ -65,13 +65,13 @@ namespace Fungus
/// </summary>
public static IEnumerator ShowTimer(this MenuDialog menuDialog, float duration, LuaEnvironment luaEnvironment, Closure callBack)
{
if (menuDialog.cachedSlider == null ||
if (menuDialog.CachedSlider == null ||
duration <= 0f)
{
yield break;
}
menuDialog.cachedSlider.gameObject.SetActive(true);
menuDialog.CachedSlider.gameObject.SetActive(true);
menuDialog.StopAllCoroutines();
float elapsedTime = 0;

12
Assets/Fungus/Narrative/Editor/CharacterEditor.cs

@ -46,19 +46,19 @@ namespace Fungus
EditorGUILayout.PropertyField(setSayDialogProp);
EditorGUILayout.PropertyField(descriptionProp, new GUIContent("Description", "Notes about this story character (personality, attibutes, etc.)"));
if (t.portraits != null &&
t.portraits.Count > 0)
if (t.Portraits != null &&
t.Portraits.Count > 0)
{
t.profileSprite = t.portraits[0];
t.ProfileSprite = t.Portraits[0];
}
else
{
t.profileSprite = null;
t.ProfileSprite = null;
}
if (t.profileSprite != null)
if (t.ProfileSprite != null)
{
Texture2D characterTexture = t.profileSprite.texture;
Texture2D characterTexture = t.ProfileSprite.texture;
float aspect = (float)characterTexture.width / (float)characterTexture.height;
Rect previewRect = GUILayoutUtility.GetAspectRect(aspect, GUILayout.Width(100), GUILayout.ExpandWidth(true));
if (characterTexture != null)

6
Assets/Fungus/Narrative/Editor/LocalizationEditor.cs

@ -78,7 +78,7 @@ namespace Fungus
TextAsset textAsset = AssetDatabase.LoadAssetAtPath(path, typeof(TextAsset)) as TextAsset;
if (textAsset != null)
{
localization.localizationFile = textAsset;
localization.LocalizationFile = textAsset;
}
ShowNotification(localization);
@ -119,8 +119,8 @@ namespace Fungus
protected virtual void ShowNotification(Localization localization)
{
FlowchartWindow.ShowNotification(localization.notificationText);
localization.notificationText = "";
FlowchartWindow.ShowNotification(localization.NotificationText);
localization.NotificationText = "";
}
}

98
Assets/Fungus/Narrative/Editor/PortraitEditor.cs

@ -75,14 +75,14 @@ namespace Fungus
}
else
{
t.stage = null;
t._Stage = null;
}
// Format Enum names
string[] displayLabels = StringFormatter.FormatEnumNames(t.display,"<None>");
string[] displayLabels = StringFormatter.FormatEnumNames(t.Display,"<None>");
displayProp.enumValueIndex = EditorGUILayout.Popup("Display", (int)displayProp.enumValueIndex, displayLabels);
string characterLabel = "Character";
if (t.display == DisplayType.Replace)
if (t.Display == DisplayType.Replace)
{
CommandEditor.ObjectField<Character>(replacedCharacterProp,
new GUIContent("Replace", "Character to replace"),
@ -97,19 +97,19 @@ namespace Fungus
Character.activeCharacters);
bool showOptionalFields = true;
Stage s = t.stage;
Stage s = t._Stage;
// Only show optional portrait fields once required fields have been filled...
if (t.character != null) // Character is selected
if (t._Character != null) // Character is selected
{
if (t.character.portraits == null || // Character has a portraits field
t.character.portraits.Count <= 0 ) // Character has at least one portrait
if (t._Character.Portraits == null || // Character has a portraits field
t._Character.Portraits.Count <= 0 ) // Character has at least one portrait
{
EditorGUILayout.HelpBox("This character has no portraits. Please add portraits to the character's prefab before using this command.", MessageType.Error);
showOptionalFields = false;
}
if (t.stage == null) // If default portrait stage selected
if (t._Stage == null) // If default portrait stage selected
{
if (t.stage == null) // If no default specified, try to get any portrait stage in the scene
if (t._Stage == null) // If no default specified, try to get any portrait stage in the scene
{
s = GameObject.FindObjectOfType<Stage>();
}
@ -120,16 +120,16 @@ namespace Fungus
showOptionalFields = false;
}
}
if (t.display != DisplayType.None && t.character != null && showOptionalFields)
if (t.Display != DisplayType.None && t._Character != null && showOptionalFields)
{
if (t.display != DisplayType.Hide && t.display != DisplayType.MoveToFront)
if (t.Display != DisplayType.Hide && t.Display != DisplayType.MoveToFront)
{
// PORTRAIT
CommandEditor.ObjectField<Sprite>(portraitProp,
new GUIContent("Portrait", "Portrait representing character"),
new GUIContent("<Previous>"),
t.character.portraits);
if (t.character.portraitsFace != FacingDirection.None)
t._Character.Portraits);
if (t._Character.PortraitsFace != FacingDirection.None)
{
// FACING
// Display the values of the facing enum as <-- and --> arrows to avoid confusion with position field
@ -143,91 +143,91 @@ namespace Fungus
}
else
{
t.facing = FacingDirection.None;
t.Facing = FacingDirection.None;
}
}
else
{
t.portrait = null;
t.facing = FacingDirection.None;
t._Portrait = null;
t.Facing = FacingDirection.None;
}
string toPositionPrefix = "";
if (t.move)
if (t.Move)
{
// MOVE
EditorGUILayout.PropertyField(moveProp);
}
if (t.move)
if (t.Move)
{
if (t.display != DisplayType.Hide)
if (t.Display != DisplayType.Hide)
{
// START FROM OFFSET
EditorGUILayout.PropertyField(shiftIntoPlaceProp);
}
}
if (t.move)
if (t.Move)
{
if (t.display != DisplayType.Hide)
if (t.Display != DisplayType.Hide)
{
if (t.shiftIntoPlace)
if (t.ShiftIntoPlace)
{
t.fromPosition = null;
t.FromPosition = null;
// OFFSET
// Format Enum names
string[] offsetLabels = StringFormatter.FormatEnumNames(t.offset,"<Previous>");
string[] offsetLabels = StringFormatter.FormatEnumNames(t.Offset,"<Previous>");
offsetProp.enumValueIndex = EditorGUILayout.Popup("From Offset", (int)offsetProp.enumValueIndex, offsetLabels);
}
else
{
t.offset = PositionOffset.None;
t.Offset = PositionOffset.None;
// FROM POSITION
CommandEditor.ObjectField<RectTransform>(fromPositionProp,
new GUIContent("From Position", "Move the portrait to this position"),
new GUIContent("<Previous>"),
s.positions);
s.Positions);
}
}
toPositionPrefix = "To ";
}
else
{
t.shiftIntoPlace = false;
t.fromPosition = null;
t.ShiftIntoPlace = false;
t.FromPosition = null;
toPositionPrefix = "At ";
}
if (t.display == DisplayType.Show || (t.display == DisplayType.Hide && t.move) )
if (t.Display == DisplayType.Show || (t.Display == DisplayType.Hide && t.Move) )
{
// TO POSITION
CommandEditor.ObjectField<RectTransform>(toPositionProp,
new GUIContent(toPositionPrefix+"Position", "Move the portrait to this position"),
new GUIContent("<Previous>"),
s.positions);
s.Positions);
}
else
{
t.toPosition = null;
t.ToPosition = null;
}
if (!t.move && t.display != DisplayType.MoveToFront)
if (!t.Move && t.Display != DisplayType.MoveToFront)
{
// MOVE
EditorGUILayout.PropertyField(moveProp);
}
if (t.display != DisplayType.MoveToFront)
if (t.Display != DisplayType.MoveToFront)
{
EditorGUILayout.Separator();
// USE DEFAULT SETTINGS
EditorGUILayout.PropertyField(useDefaultSettingsProp);
if (!t.useDefaultSettings) {
if (!t.UseDefaultSettings) {
// FADE DURATION
EditorGUILayout.PropertyField(fadeDurationProp);
if (t.move)
if (t.Move)
{
// MOVE SPEED
EditorGUILayout.PropertyField(moveDurationProp);
}
if (t.shiftIntoPlace)
if (t.ShiftIntoPlace)
{
// SHIFT OFFSET
EditorGUILayout.PropertyField(shiftOffsetProp);
@ -236,17 +236,17 @@ namespace Fungus
}
else
{
t.move = false;
t.useDefaultSettings = true;
t.Move = false;
t.UseDefaultSettings = true;
EditorGUILayout.Separator();
}
EditorGUILayout.PropertyField(waitUntilFinishedProp);
if (t.portrait != null && t.display != DisplayType.Hide)
if (t._Portrait != null && t.Display != DisplayType.Hide)
{
Texture2D characterTexture = t.portrait.texture;
Texture2D characterTexture = t._Portrait.texture;
float aspect = (float)characterTexture.width / (float)characterTexture.height;
Rect previewRect = GUILayoutUtility.GetAspectRect(aspect, GUILayout.Width(100), GUILayout.ExpandWidth(true));
@ -257,12 +257,12 @@ namespace Fungus
}
}
if (t.display != DisplayType.Hide)
if (t.Display != DisplayType.Hide)
{
string portraitName = "<Previous>";
if (t.portrait != null)
if (t._Portrait != null)
{
portraitName = t.portrait.name;
portraitName = t._Portrait.name;
}
string portraitSummary = " " + portraitName;
int toolbarInt = 1;
@ -272,8 +272,8 @@ namespace Fungus
if (toolbarInt != 1)
{
for(int i=0; i<t.character.portraits.Count; i++){
if(portraitName == t.character.portraits[i].name)
for(int i=0; i<t._Character.Portraits.Count; i++){
if(portraitName == t._Character.Portraits[i].name)
{
portraitIndex = i;
}
@ -284,18 +284,18 @@ namespace Fungus
{
if(portraitIndex > 0)
{
t.portrait = t.character.portraits[--portraitIndex];
t._Portrait = t._Character.Portraits[--portraitIndex];
}
else
{
t.portrait = null;
t._Portrait = null;
}
}
if (toolbarInt == 2)
{
if(portraitIndex < t.character.portraits.Count-1)
if(portraitIndex < t._Character.Portraits.Count-1)
{
t.portrait = t.character.portraits[++portraitIndex];
t._Portrait = t._Character.Portraits[++portraitIndex];
}
}
}

28
Assets/Fungus/Narrative/Editor/SayEditor.cs

@ -50,8 +50,8 @@ namespace Fungus
if (parentTag != null)
{
tagName = parentTag.name;
tagStartSymbol = parentTag.tagStartSymbol;
tagEndSymbol = parentTag.tagEndSymbol;
tagStartSymbol = parentTag.TagStartSymbol;
tagEndSymbol = parentTag.TagEndSymbol;
}
tagsText += "\n\n\t" + tagStartSymbol + " " + tagName + " " + tagEndSymbol;
foreach(Transform child in parent)
@ -63,8 +63,8 @@ namespace Fungus
if (childTag != null)
{
tagName = childTag.name;
tagStartSymbol = childTag.tagStartSymbol;
tagEndSymbol = childTag.tagEndSymbol;
tagStartSymbol = childTag.TagStartSymbol;
tagEndSymbol = childTag.TagEndSymbol;
}
tagsText += "\n\t " + tagStartSymbol + " " + tagName + " " + tagEndSymbol;
}
@ -135,9 +135,9 @@ namespace Fungus
Say t = target as Say;
// Only show portrait selection if...
if (t.character != null && // Character is selected
t.character.portraits != null && // Character has a portraits field
t.character.portraits.Count > 0 ) // Selected Character has at least 1 portrait
if (t._Character != null && // Character is selected
t._Character.Portraits != null && // Character has a portraits field
t._Character.Portraits.Count > 0 ) // Selected Character has at least 1 portrait
{
showPortraits = true;
}
@ -145,15 +145,15 @@ namespace Fungus
if (showPortraits)
{
CommandEditor.ObjectField<Sprite>(portraitProp,
new GUIContent("Portrait", "Portrait representing speaking character"),
new GUIContent("<None>"),
t.character.portraits);
new GUIContent("Portrait", "Portrait representing speaking character"),
new GUIContent("<None>"),
t._Character.Portraits);
}
else
{
if (!t.extendPrevious)
if (!t.ExtendPrevious)
{
t.portrait = null;
t.Portrait = null;
}
}
@ -204,9 +204,9 @@ namespace Fungus
EditorGUILayout.PropertyField(stopVoiceoverProp);
EditorGUILayout.PropertyField(setSayDialogProp);
if (showPortraits && t.portrait != null)
if (showPortraits && t.Portrait != null)
{
Texture2D characterTexture = t.portrait.texture;
Texture2D characterTexture = t.Portrait.texture;
float aspect = (float)characterTexture.width / (float)characterTexture.height;
Rect previewRect = GUILayoutUtility.GetAspectRect(aspect, GUILayout.Width(100), GUILayout.ExpandWidth(true));
if (characterTexture != null)

14
Assets/Fungus/Narrative/Editor/StageEditor.cs

@ -47,11 +47,11 @@ namespace Fungus
ControlStage t = target as ControlStage;
// Format Enum names
string[] displayLabels = StringFormatter.FormatEnumNames(t.display,"<None>");
string[] displayLabels = StringFormatter.FormatEnumNames(t.Display,"<None>");
displayProp.enumValueIndex = EditorGUILayout.Popup("Display", (int)displayProp.enumValueIndex, displayLabels);
string replaceLabel = "Portrait Stage";
if (t.display == StageDisplayType.Swap)
if (t.Display == StageDisplayType.Swap)
{
CommandEditor.ObjectField<Stage>(replacedStageProp,
new GUIContent("Replace", "Character to swap with"),
@ -69,11 +69,11 @@ namespace Fungus
}
bool showOptionalFields = true;
Stage s = t.stage;
Stage s = t._Stage;
// Only show optional portrait fields once required fields have been filled...
if (t.stage != null) // Character is selected
if (t._Stage != null) // Character is selected
{
if (t.stage == null) // If no default specified, try to get any portrait stage in the scene
if (t._Stage == null) // If no default specified, try to get any portrait stage in the scene
{
s = GameObject.FindObjectOfType<Stage>();
}
@ -83,10 +83,10 @@ namespace Fungus
showOptionalFields = false;
}
}
if (t.display != StageDisplayType.None && showOptionalFields)
if (t.Display != StageDisplayType.None && showOptionalFields)
{
EditorGUILayout.PropertyField(useDefaultSettingsProp);
if (!t.useDefaultSettings)
if (!t.UseDefaultSettings)
{
EditorGUILayout.PropertyField(fadeDurationProp);
}

40
Assets/Fungus/Narrative/Scripts/Character.cs

@ -15,20 +15,42 @@ namespace Fungus
[ExecuteInEditMode]
public class Character : MonoBehaviour, ILocalizable
{
public string nameText; // We need a separate name as the object name is used for character variations (e.g. "Smurf Happy", "Smurf Sad")
public Color nameColor = Color.white;
public AudioClip soundEffect;
public Sprite profileSprite;
public List<Sprite> portraits;
public FacingDirection portraitsFace;
public PortraitState state = new PortraitState();
[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.")]
public SayDialog setSayDialog;
[SerializeField] protected SayDialog setSayDialog;
public SayDialog SetSayDialog { get { return setSayDialog; } }
[FormerlySerializedAs("notes")]
[TextArea(5,10)]
public string description;
[SerializeField] protected string description;
static public List<Character> activeCharacters = new List<Character>();

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

@ -15,7 +15,7 @@ namespace Fungus
public class ClearMenu : Command
{
[Tooltip("Menu Dialog to clear the options on")]
public MenuDialog menuDialog;
[SerializeField] protected MenuDialog menuDialog;
public override void OnEnter()
{

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

@ -29,19 +29,23 @@ namespace Fungus
public class ControlStage : ControlWithDisplay<StageDisplayType>
{
[Tooltip("Stage to display characters on")]
public Stage stage;
[SerializeField] protected Stage stage;
public Stage _Stage { get { return stage; } }
[Tooltip("Stage to swap with")]
public Stage replacedStage;
[SerializeField] protected Stage replacedStage;
[Tooltip("Use Default Settings")]
public bool useDefaultSettings = true;
[SerializeField] protected bool useDefaultSettings = true;
public bool UseDefaultSettings { get { return useDefaultSettings; } }
[Tooltip("Fade Duration")]
public float fadeDuration;
[SerializeField] protected float fadeDuration;
[Tooltip("Wait until the tween has finished before executing the next command")]
public bool waitUntilFinished = false;
[SerializeField] protected bool waitUntilFinished = false;
public override void OnEnter()
{
@ -83,7 +87,7 @@ namespace Fungus
// Use default settings
if (useDefaultSettings)
{
fadeDuration = stage.fadeDuration;
fadeDuration = stage.FadeDuration;
}
switch(display)
{
@ -139,19 +143,19 @@ namespace Fungus
{
if (s == stage)
{
s.portraitCanvas.sortingOrder = 1;
s.PortraitCanvas.sortingOrder = 1;
}
else
{
s.portraitCanvas.sortingOrder = 0;
s.PortraitCanvas.sortingOrder = 0;
}
}
}
protected void UndimAllPortraits(Stage stage)
{
stage.dimPortraits = false;
foreach (Character character in stage.charactersOnStage)
stage.DimPortraits = false;
foreach (Character character in stage.CharactersOnStage)
{
stage.SetDimmed(character, false);
}
@ -159,7 +163,7 @@ namespace Fungus
protected void DimNonSpeakingPortraits(Stage stage)
{
stage.dimPortraits = true;
stage.DimPortraits = true;
}
protected void OnComplete()

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

@ -11,7 +11,9 @@ namespace Fungus
public class ControlWithDisplay<TDisplayEnum> : Command
{
[Tooltip("Display type")]
public TDisplayEnum display;
[SerializeField] protected TDisplayEnum display;
public TDisplayEnum Display { get { return display; } }
protected bool IsDisplayNone<TEnum>(TEnum enumValue)
{

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

@ -16,9 +16,9 @@ namespace Fungus
[ExecuteInEditMode]
public class Conversation : Command
{
public StringDataMulti conversationText;
[SerializeField] protected StringDataMulti conversationText;
public ConversationManager conversationManager = new ConversationManager();
protected ConversationManager conversationManager = new ConversationManager();
protected virtual void Start()
{

12
Assets/Fungus/Narrative/Scripts/Commands/Menu.cs

@ -18,23 +18,23 @@ namespace Fungus
public class Menu : Command, ILocalizable
{
[Tooltip("Text to display on the menu button")]
public string text = "Option Text";
[SerializeField] protected string text = "Option Text";
[Tooltip("Notes about the option text for other authors, localization, etc.")]
public string description = "";
[SerializeField] protected string description = "";
[FormerlySerializedAs("targetSequence")]
[Tooltip("Block to execute when this option is selected")]
public Block targetBlock;
[SerializeField] protected Block targetBlock;
[Tooltip("Hide this option if the target block has been executed previously")]
public bool hideIfVisited;
[SerializeField] protected bool hideIfVisited;
[Tooltip("If false, the menu option will be displayed but will not be selectable")]
public BooleanData interactable = new BooleanData(true);
[SerializeField] protected BooleanData interactable = new BooleanData(true);
[Tooltip("A custom Menu Dialog to use to display this menu. All subsequent Menu commands will use this dialog.")]
public MenuDialog setMenuDialog;
[SerializeField] protected MenuDialog setMenuDialog;
public override void OnEnter()
{

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

@ -20,11 +20,11 @@ namespace Fungus
public class MenuTimer : Command
{
[Tooltip("Length of time to display the timer for")]
public FloatData _duration = new FloatData(1);
[SerializeField] protected FloatData _duration = new FloatData(1);
[FormerlySerializedAs("targetSequence")]
[Tooltip("Block to execute when the timer expires")]
public Block targetBlock;
[SerializeField] protected Block targetBlock;
public override void OnEnter()
{

66
Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs

@ -19,49 +19,69 @@ namespace Fungus
public class Portrait : ControlWithDisplay<DisplayType>
{
[Tooltip("Stage to display portrait on")]
public Stage stage;
[SerializeField] protected Stage stage;
public Stage _Stage { get { return stage; } set { stage = value; } }
[Tooltip("Character to display")]
public Character character;
[SerializeField] protected Character character;
public Character _Character { get { return character; } set { character = value; } }
[Tooltip("Character to swap with")]
public Character replacedCharacter;
[SerializeField] protected Character replacedCharacter;
[Tooltip("Portrait to display")]
public Sprite portrait;
[SerializeField] protected Sprite portrait;
public Sprite _Portrait { get { return portrait; } set { portrait = value; } }
[Tooltip("Move the portrait from/to this offset position")]
public PositionOffset offset;
[SerializeField] protected PositionOffset offset;
public PositionOffset Offset { get { return offset; } set { offset = value; } }
[Tooltip("Move the portrait from this position")]
public RectTransform fromPosition;
[SerializeField] protected RectTransform fromPosition;
public RectTransform FromPosition { get { return fromPosition; } set { fromPosition = value;} }
[Tooltip("Move the portrait to this positoin")]
public RectTransform toPosition;
[SerializeField] protected RectTransform toPosition;
public RectTransform ToPosition { get { return toPosition; } set { toPosition = value;} }
[Tooltip("Direction character is facing")]
public FacingDirection facing;
[SerializeField] protected FacingDirection facing;
public FacingDirection Facing { get { return facing; } set { facing = value; } }
[Tooltip("Use Default Settings")]
public bool useDefaultSettings = true;
[SerializeField] protected bool useDefaultSettings = true;
public bool UseDefaultSettings { get { return useDefaultSettings; } set { useDefaultSettings = value; } }
[Tooltip("Fade Duration")]
public float fadeDuration = 0.5f;
[SerializeField] protected float fadeDuration = 0.5f;
[Tooltip("Movement Duration")]
public float moveDuration = 1f;
[SerializeField] protected float moveDuration = 1f;
[Tooltip("Shift Offset")]
public Vector2 shiftOffset;
[SerializeField] protected Vector2 shiftOffset;
[Tooltip("Move")]
public bool move;
[SerializeField] protected bool move;
public bool Move { get { return move; } set { move = value; } }
[Tooltip("Start from offset")]
public bool shiftIntoPlace;
[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")]
public bool waitUntilFinished = false;
[SerializeField] protected bool waitUntilFinished = false;
public override void OnEnter()
{

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

@ -18,40 +18,46 @@ namespace Fungus
{
// Removed this tooltip as users's reported it obscures the text box
[TextArea(5,10)]
public string storyText = "";
[SerializeField] protected string storyText = "";
[Tooltip("Notes about this story text for other authors, localization, etc.")]
public string description = "";
[SerializeField] protected string description = "";
[Tooltip("Character that is speaking")]
public Character character;
[SerializeField] protected Character character;
public Character _Character { get { return character; } }
[Tooltip("Portrait that represents speaking character")]
public Sprite portrait;
[SerializeField] protected Sprite portrait;
public Sprite Portrait { get { return portrait; } set { portrait = value; } }
[Tooltip("Voiceover audio to play when writing the text")]
public AudioClip voiceOverClip;
[SerializeField] protected AudioClip voiceOverClip;
[Tooltip("Always show this Say text when the command is executed multiple times")]
public bool showAlways = true;
[SerializeField] protected bool showAlways = true;
[Tooltip("Number of times to show this Say text when the command is executed multiple times")]
public int showCount = 1;
[SerializeField] protected int showCount = 1;
[Tooltip("Type this text in the previous dialog box.")]
public bool extendPrevious = false;
[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.")]
public bool fadeWhenDone = true;
[SerializeField] protected bool fadeWhenDone = true;
[Tooltip("Wait for player to click before continuing.")]
public bool waitForClick = true;
[SerializeField] protected bool waitForClick = true;
[Tooltip("Stop playing voiceover when text finishes writing.")]
public bool stopVoiceover = true;
[SerializeField] protected bool stopVoiceover = true;
[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.")]
public SayDialog setSayDialog;
[SerializeField] protected SayDialog setSayDialog;
protected int executionCount;
@ -66,9 +72,9 @@ namespace Fungus
executionCount++;
// Override the active say dialog if needed
if (character != null && character.setSayDialog != null)
if (character != null && character.SetSayDialog != null)
{
SayDialog.activeSayDialog = character.setSayDialog;
SayDialog.activeSayDialog = character.SetSayDialog;
}
if (setSayDialog != null)
@ -95,10 +101,10 @@ namespace Fungus
foreach (CustomTag ct in CustomTag.activeCustomTags)
{
displayText = displayText.Replace(ct.tagStartSymbol, ct.replaceTagStartWith);
if (ct.tagEndSymbol != "" && ct.replaceTagEndWith != "")
displayText = displayText.Replace(ct.TagStartSymbol, ct.ReplaceTagStartWith);
if (ct.TagEndSymbol != "" && ct.ReplaceTagEndWith != "")
{
displayText = displayText.Replace(ct.tagEndSymbol, ct.replaceTagEndWith);
displayText = displayText.Replace(ct.TagEndSymbol, ct.ReplaceTagEndWith);
}
}
@ -114,7 +120,7 @@ namespace Fungus
string namePrefix = "";
if (character != null)
{
namePrefix = character.nameText + ": ";
namePrefix = character.NameText + ": ";
}
if (extendPrevious)
{
@ -169,7 +175,7 @@ namespace Fungus
string stringId = "SAY." + GetFlowchartLocalizationId() + "." + itemId + ".";
if (character != null)
{
stringId += character.nameText;
stringId += character.NameText;
}
return stringId;

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

@ -17,7 +17,7 @@ namespace Fungus
public class SetLanguage : Command
{
[Tooltip("Code of the language to set. e.g. ES, DE, JA")]
public StringData _languageCode = new StringData();
[SerializeField] protected StringData _languageCode = new StringData();
public static string mostRecentLanguage = "";

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

@ -16,7 +16,7 @@ namespace Fungus
public class SetMenuDialog : Command
{
[Tooltip("The Menu Dialog to use for displaying menu buttons")]
public MenuDialog menuDialog;
[SerializeField] protected MenuDialog menuDialog;
public override void OnEnter()
{

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

@ -16,7 +16,7 @@ namespace Fungus
public class SetSayDialog : Command
{
[Tooltip("The Say Dialog to use for displaying Say story text")]
public SayDialog sayDialog;
[SerializeField] protected SayDialog sayDialog;
public override void OnEnter()
{

14
Assets/Fungus/Narrative/Scripts/ConversationManager.cs

@ -33,9 +33,9 @@ namespace Fungus
SayDialog sayDialog = null;
if (character != null)
{
if (character.setSayDialog != null)
if (character.SetSayDialog != null)
{
sayDialog = character.setSayDialog;
sayDialog = character.SetSayDialog;
}
}
@ -103,19 +103,19 @@ namespace Fungus
var stage = Stage.GetActiveStage();
if (stage != null && currentCharacter != null &&
(currentPortrait != currentCharacter.state.portrait ||
currentPosition != currentCharacter.state.position))
(currentPortrait != currentCharacter.State.portrait ||
currentPosition != currentCharacter.State.position))
{
var portraitOptions = new PortraitOptions(true);
portraitOptions.display = item.Hide ? DisplayType.Hide : DisplayType.Show;
portraitOptions.character = currentCharacter;
portraitOptions.fromPosition = currentCharacter.state.position;
portraitOptions.fromPosition = currentCharacter.State.position;
portraitOptions.toPosition = currentPosition;
portraitOptions.portrait = currentPortrait;
// Do a move tween if the character is already on screen and not yet at the specified position
if (currentCharacter.state.onScreen &&
currentPosition != currentCharacter.state.position)
if (currentCharacter.State.onScreen &&
currentPosition != currentCharacter.State.position)
{
portraitOptions.move = true;
}

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

@ -14,11 +14,22 @@ namespace Fungus
[ExecuteInEditMode]
public class CustomTag : MonoBehaviour
{
public string tagStartSymbol;
public string tagEndSymbol;
public string replaceTagStartWith;
public string replaceTagEndWith;
[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>();
protected virtual void OnEnable()

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

@ -25,16 +25,16 @@ namespace Fungus
}
[Tooltip("Click to advance story")]
public ClickMode clickMode;
[SerializeField] protected ClickMode clickMode;
[Tooltip("Delay between consecutive clicks. Useful to prevent accidentally clicking through story.")]
public float nextClickDelay = 0f;
[SerializeField] protected float nextClickDelay = 0f;
[Tooltip("Allow holding Cancel to fast forward text")]
public bool cancelEnabled = true;
[SerializeField] protected bool cancelEnabled = true;
[Tooltip("Ignore input if a Menu dialog is currently active")]
public bool ignoreMenuClicks = true;
[SerializeField] protected bool ignoreMenuClicks = true;
protected bool dialogClickedFlag;

13
Assets/Fungus/Narrative/Scripts/Localization.cs

@ -35,7 +35,9 @@ namespace Fungus
* 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)")]
public string activeLanguage = "";
[SerializeField] protected string activeLanguage = "";
public string ActiveLanguage { get { return activeLanguage; } }
protected static Dictionary<string, string> localizedStrings = new Dictionary<string, string>();
@ -55,13 +57,16 @@ namespace Fungus
* 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")]
public TextAsset localizationFile;
[SerializeField] protected TextAsset localizationFile;
public TextAsset LocalizationFile { get { return localizationFile; } set { localizationFile = value; } }
/**
* Stores any notification message from export / import methods.
*/
[NonSerialized]
public string notificationText = "";
protected string notificationText = "";
public string NotificationText { get { return notificationText; } set { notificationText = value; } }
protected bool initialized;

12
Assets/Fungus/Narrative/Scripts/MenuDialog.cs

@ -21,13 +21,15 @@ namespace Fungus
public static MenuDialog activeMenuDialog;
[Tooltip("Automatically select the first interactable button when the menu is shown.")]
public bool autoSelectFirstButton = false;
[SerializeField] protected bool autoSelectFirstButton = false;
[NonSerialized]
public Button[] cachedButtons;
protected Button[] cachedButtons;
[NonSerialized]
public Slider cachedSlider;
public Button[] CachedButtons { get { return cachedButtons; } }
protected Slider cachedSlider;
public Slider CachedSlider { get { return cachedSlider; } }
public static MenuDialog GetMenuDialog()
{

134
Assets/Fungus/Narrative/Scripts/PortraitController.cs

@ -139,7 +139,7 @@ namespace Fungus
// Early out if hiding a character that's already hidden
if (options.display == DisplayType.Hide &&
!options.character.state.onScreen)
!options.character.State.onScreen)
{
onComplete();
return;
@ -160,7 +160,7 @@ namespace Fungus
case (DisplayType.Replace):
Show(options);
Hide(options.replacedCharacter, options.replacedCharacter.state.position.name);
Hide(options.replacedCharacter, options.replacedCharacter.State.position.name);
break;
case (DisplayType.MoveToFront):
@ -199,54 +199,54 @@ namespace Fungus
// Use default stage settings
if (options.useDefaultSettings)
{
options.fadeDuration = stage.fadeDuration;
options.moveDuration = stage.moveDuration;
options.shiftOffset = stage.shiftOffset;
options.fadeDuration = stage.FadeDuration;
options.moveDuration = stage.MoveDuration;
options.shiftOffset = stage.ShiftOffset;
}
// if no previous portrait, use default portrait
if (options.character.state.portrait == null)
if (options.character.State.portrait == null)
{
options.character.state.portrait = options.character.profileSprite;
options.character.State.portrait = options.character.ProfileSprite;
}
// Selected "use previous portrait"
if (options.portrait == null)
{
options.portrait = options.character.state.portrait;
options.portrait = options.character.State.portrait;
}
// if no previous position, use default position
if (options.character.state.position == null)
if (options.character.State.position == null)
{
options.character.state.position = stage.defaultPosition.rectTransform;
options.character.State.position = stage.DefaultPosition.rectTransform;
}
// Selected "use previous position"
if (options.toPosition == null)
{
options.toPosition = options.character.state.position;
options.toPosition = options.character.State.position;
}
if (options.replacedCharacter != null)
{
// if no previous position, use default position
if (options.replacedCharacter.state.position == null)
if (options.replacedCharacter.State.position == null)
{
options.replacedCharacter.state.position = stage.defaultPosition.rectTransform;
options.replacedCharacter.State.position = stage.DefaultPosition.rectTransform;
}
}
// If swapping, use replaced character's position
if (options.display == DisplayType.Replace)
{
options.toPosition = options.replacedCharacter.state.position;
options.toPosition = options.replacedCharacter.State.position;
}
// Selected "use previous position"
if (options.fromPosition == null)
{
options.fromPosition = options.character.state.position;
options.fromPosition = options.character.State.position;
}
// if portrait not moving, use from position is same as to position
@ -257,22 +257,22 @@ namespace Fungus
if (options.display == DisplayType.Hide)
{
options.fromPosition = options.character.state.position;
options.fromPosition = options.character.State.position;
}
// if no previous facing direction, use default facing direction
if (options.character.state.facing == FacingDirection.None)
if (options.character.State.facing == FacingDirection.None)
{
options.character.state.facing = options.character.portraitsFace;
options.character.State.facing = options.character.PortraitsFace;
}
// Selected "use previous facing direction"
if (options.facing == FacingDirection.None)
{
options.facing = options.character.state.facing;
options.facing = options.character.State.facing;
}
if (options.character.state.portraitImage == null)
if (options.character.State.portraitImage == null)
{
CreatePortraitObject(options.character, options.fadeDuration);
}
@ -294,22 +294,22 @@ namespace Fungus
typeof(Image));
// Set it to be a child of the stage
portraitObj.transform.SetParent(stage.portraitCanvas.transform, true);
portraitObj.transform.SetParent(stage.PortraitCanvas.transform, true);
// Configure the portrait image
Image portraitImage = portraitObj.GetComponent<Image>();
portraitImage.preserveAspect = true;
portraitImage.sprite = character.profileSprite;
portraitImage.sprite = character.ProfileSprite;
portraitImage.color = new Color(1f, 1f, 1f, 0f);
// LeanTween doesn't handle 0 duration properly
float duration = (fadeDuration > 0f) ? fadeDuration : float.Epsilon;
// Fade in character image (first time)
LeanTween.alpha(portraitImage.transform as RectTransform, 1f, duration).setEase(stage.fadeEaseType);
LeanTween.alpha(portraitImage.transform as RectTransform, 1f, duration).setEase(stage.FadeEaseType);
// Tell character about portrait image
character.state.portraitImage = portraitImage;
character.State.portraitImage = portraitImage;
}
private IEnumerator WaitUntilFinished(float duration, Action onComplete = null)
@ -332,24 +332,24 @@ namespace Fungus
private void SetupPortrait(PortraitOptions options)
{
SetRectTransform(options.character.state.portraitImage.rectTransform, options.fromPosition);
SetRectTransform(options.character.State.portraitImage.rectTransform, options.fromPosition);
if (options.character.state.facing != options.character.portraitsFace)
if (options.character.State.facing != options.character.PortraitsFace)
{
options.character.state.portraitImage.rectTransform.localScale = new Vector3(-1f, 1f, 1f);
options.character.State.portraitImage.rectTransform.localScale = new Vector3(-1f, 1f, 1f);
}
else
{
options.character.state.portraitImage.rectTransform.localScale = new Vector3(1f, 1f, 1f);
options.character.State.portraitImage.rectTransform.localScale = new Vector3(1f, 1f, 1f);
}
if (options.facing != options.character.portraitsFace)
if (options.facing != options.character.PortraitsFace)
{
options.character.state.portraitImage.rectTransform.localScale = new Vector3(-1f, 1f, 1f);
options.character.State.portraitImage.rectTransform.localScale = new Vector3(-1f, 1f, 1f);
}
else
{
options.character.state.portraitImage.rectTransform.localScale = new Vector3(1f, 1f, 1f);
options.character.State.portraitImage.rectTransform.localScale = new Vector3(1f, 1f, 1f);
}
}
@ -380,8 +380,8 @@ namespace Fungus
public void MoveToFront(PortraitOptions options)
{
options.character.state.portraitImage.transform.SetSiblingIndex(options.character.state.portraitImage.transform.parent.childCount);
options.character.state.display = DisplayType.MoveToFront;
options.character.State.portraitImage.transform.SetSiblingIndex(options.character.State.portraitImage.transform.parent.childCount);
options.character.State.display = DisplayType.MoveToFront;
FinishCommand(options);
}
@ -405,7 +405,7 @@ namespace Fungus
float duration = (options.moveDuration > 0f) ? options.moveDuration : float.Epsilon;
// LeanTween.move uses the anchoredPosition, so all position images must have the same anchor position
LeanTween.move(options.character.state.portraitImage.gameObject, options.toPosition.position, duration).setEase(stage.fadeEaseType);
LeanTween.move(options.character.State.portraitImage.gameObject, options.toPosition.position, duration).setEase(stage.FadeEaseType);
if (options.waitUntilFinished)
{
@ -493,47 +493,47 @@ namespace Fungus
float duration = (options.fadeDuration > 0f) ? options.fadeDuration : float.Epsilon;
// Fade out a duplicate of the existing portrait image
if (options.character.state.portraitImage != null)
if (options.character.State.portraitImage != null)
{
GameObject tempGO = GameObject.Instantiate(options.character.state.portraitImage.gameObject);
tempGO.transform.SetParent(options.character.state.portraitImage.transform, false);
GameObject tempGO = GameObject.Instantiate(options.character.State.portraitImage.gameObject);
tempGO.transform.SetParent(options.character.State.portraitImage.transform, false);
tempGO.transform.localPosition = Vector3.zero;
tempGO.transform.localScale = options.character.state.position.localScale;
tempGO.transform.localScale = options.character.State.position.localScale;
Image tempImage = tempGO.GetComponent<Image>();
tempImage.sprite = options.character.state.portraitImage.sprite;
tempImage.sprite = options.character.State.portraitImage.sprite;
tempImage.preserveAspect = true;
tempImage.color = options.character.state.portraitImage.color;
tempImage.color = options.character.State.portraitImage.color;
LeanTween.alpha(tempImage.rectTransform, 0f, duration).setEase(stage.fadeEaseType).setOnComplete(() => {
LeanTween.alpha(tempImage.rectTransform, 0f, duration).setEase(stage.FadeEaseType).setOnComplete(() => {
Destroy(tempGO);
});
}
// Fade in the new sprite image
if (options.character.state.portraitImage.sprite != options.portrait ||
options.character.state.portraitImage.color.a < 1f)
if (options.character.State.portraitImage.sprite != options.portrait ||
options.character.State.portraitImage.color.a < 1f)
{
options.character.state.portraitImage.sprite = options.portrait;
options.character.state.portraitImage.color = new Color(1f, 1f, 1f, 0f);
LeanTween.alpha(options.character.state.portraitImage.rectTransform, 1f, duration).setEase(stage.fadeEaseType);
options.character.State.portraitImage.sprite = options.portrait;
options.character.State.portraitImage.color = new Color(1f, 1f, 1f, 0f);
LeanTween.alpha(options.character.State.portraitImage.rectTransform, 1f, duration).setEase(stage.FadeEaseType);
}
DoMoveTween(options);
FinishCommand(options);
if (!stage.charactersOnStage.Contains(options.character))
if (!stage.CharactersOnStage.Contains(options.character))
{
stage.charactersOnStage.Add(options.character);
stage.CharactersOnStage.Add(options.character);
}
// Update character state after showing
options.character.state.onScreen = true;
options.character.state.display = DisplayType.Show;
options.character.state.portrait = options.portrait;
options.character.state.facing = options.facing;
options.character.state.position = options.toPosition;
options.character.State.onScreen = true;
options.character.State.display = DisplayType.Show;
options.character.State.portrait = options.portrait;
options.character.State.facing = options.facing;
options.character.State.position = options.toPosition;
}
/// <summary>
@ -547,13 +547,13 @@ namespace Fungus
options.character = character;
options.portrait = character.GetPortrait(portrait);
if (character.state.position == null)
if (character.State.position == null)
{
options.toPosition = options.fromPosition = stage.GetPosition("middle");
}
else
{
options.fromPosition = options.toPosition = character.state.position;
options.fromPosition = options.toPosition = character.State.position;
}
Show(options);
@ -606,7 +606,7 @@ namespace Fungus
{
CleanPortraitOptions(options);
if (options.character.state.display == DisplayType.None)
if (options.character.State.display == DisplayType.None)
{
return;
}
@ -616,37 +616,37 @@ namespace Fungus
// LeanTween doesn't handle 0 duration properly
float duration = (options.fadeDuration > 0f) ? options.fadeDuration : float.Epsilon;
LeanTween.alpha(options.character.state.portraitImage.rectTransform, 0f, duration).setEase(stage.fadeEaseType);
LeanTween.alpha(options.character.State.portraitImage.rectTransform, 0f, duration).setEase(stage.FadeEaseType);
DoMoveTween(options);
stage.charactersOnStage.Remove(options.character);
stage.CharactersOnStage.Remove(options.character);
//update character state after hiding
options.character.state.onScreen = false;
options.character.state.portrait = options.portrait;
options.character.state.facing = options.facing;
options.character.state.position = options.toPosition;
options.character.state.display = DisplayType.Hide;
options.character.State.onScreen = false;
options.character.State.portrait = options.portrait;
options.character.State.facing = options.facing;
options.character.State.position = options.toPosition;
options.character.State.display = DisplayType.Hide;
FinishCommand(options);
}
public void SetDimmed(Character character, bool dimmedState)
{
if (character.state.dimmed == dimmedState)
if (character.State.dimmed == dimmedState)
{
return;
}
character.state.dimmed = dimmedState;
character.State.dimmed = dimmedState;
Color targetColor = dimmedState ? new Color(0.5f, 0.5f, 0.5f, 1f) : Color.white;
// LeanTween doesn't handle 0 duration properly
float duration = (stage.fadeDuration > 0f) ? stage.fadeDuration : float.Epsilon;
float duration = (stage.FadeDuration > 0f) ? stage.FadeDuration : float.Epsilon;
LeanTween.color(character.state.portraitImage.rectTransform, targetColor, duration).setEase(stage.fadeEaseType);
LeanTween.color(character.State.portraitImage.rectTransform, targetColor, duration).setEase(stage.FadeEaseType);
}
}

43
Assets/Fungus/Narrative/Scripts/SayDialog.cs

@ -20,16 +20,21 @@ namespace Fungus
// Most recent speaking character
public static Character speakingCharacter;
public float fadeDuration = 0.25f;
[SerializeField] protected float fadeDuration = 0.25f;
public Button continueButton;
public Canvas dialogCanvas;
public Text nameText;
public Text storyText;
public Image characterImage;
[SerializeField] protected Button continueButton;
[SerializeField] protected Canvas dialogCanvas;
[SerializeField] protected Text nameText;
[SerializeField] protected Text storyText;
public Text StoryText { get { return storyText; } }
[SerializeField] protected Image characterImage;
public Image CharacterImage { get { return characterImage; } }
[Tooltip("Adjust width of story text when Character Image is displayed (to avoid overlapping)")]
public bool fitTextWithImage = true;
[SerializeField] protected bool fitTextWithImage = true;
protected float startStoryTextWidth;
protected float startStoryTextInset;
@ -179,7 +184,7 @@ namespace Fungus
}
else if (speakingCharacter != null)
{
soundEffectClip = speakingCharacter.soundEffect;
soundEffectClip = speakingCharacter.SoundEffect;
}
yield return StartCoroutine(writer.Write(text, clearPrevious, waitForInput, stopVoiceover, soundEffectClip, onComplete));
@ -273,9 +278,9 @@ namespace Fungus
foreach (Stage stage in Stage.activeStages)
{
if (stage.dimPortraits)
if (stage.DimPortraits)
{
foreach (Character c in stage.charactersOnStage)
foreach (Character c in stage.CharactersOnStage)
{
if (prevSpeakingCharacter != speakingCharacter)
{
@ -292,7 +297,7 @@ namespace Fungus
}
}
string characterName = character.nameText;
string characterName = character.NameText;
if (characterName == "")
{
@ -305,7 +310,7 @@ namespace Fungus
characterName = flowchart.SubstituteVariables(characterName);
}
SetCharacterName(characterName, character.nameColor);
SetCharacterName(characterName, character.NameColor);
}
}
@ -391,20 +396,20 @@ namespace Fungus
// Stop all tweening portraits
foreach( Character c in Character.activeCharacters )
{
if (c.state.portraitImage != null)
if (c.State.portraitImage != null)
{
if (LeanTween.isTweening(c.state.portraitImage.gameObject))
if (LeanTween.isTweening(c.State.portraitImage.gameObject))
{
LeanTween.cancel(c.state.portraitImage.gameObject, true);
LeanTween.cancel(c.State.portraitImage.gameObject, true);
PortraitController.SetRectTransform(c.state.portraitImage.rectTransform, c.state.position);
if (c.state.dimmed == true)
PortraitController.SetRectTransform(c.State.portraitImage.rectTransform, c.State.position);
if (c.State.dimmed == true)
{
c.state.portraitImage.color = new Color(0.5f, 0.5f, 0.5f, 1f);
c.State.portraitImage.color = new Color(0.5f, 0.5f, 0.5f, 1f);
}
else
{
c.state.portraitImage.color = Color.white;
c.State.portraitImage.color = Color.white;
}
}
}

51
Assets/Fungus/Narrative/Scripts/Stage.cs

@ -16,19 +16,44 @@ namespace Fungus
[ExecuteInEditMode]
public class Stage : PortraitController
{
public Canvas portraitCanvas;
public bool dimPortraits;
public float fadeDuration = 0.5f;
public float moveDuration = 1f;
public LeanTweenType fadeEaseType;
public LeanTweenType moveEaseType;
public Vector2 shiftOffset;
public Image defaultPosition;
public List<RectTransform> positions;
public RectTransform[] cachedPositions;
public List<Character> charactersOnStage = new List<Character>();
[HideInInspector]
[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>();
protected virtual void OnEnable()

390
Assets/Tests/Localisation/LocalisationTests.unity

File diff suppressed because it is too large Load Diff

12
Assets/Tests/Narrative/NarrativeTests.cs

@ -103,7 +103,7 @@ public class NarrativeTests : Command
// Test showing multiple characters
protected virtual void TestShow()
{
bool found = (stage.charactersOnStage.Count == 2);
bool found = (stage.CharactersOnStage.Count == 2);
GameObject johnGO = stage.transform.Find("Canvas/JohnCharacter").gameObject;
GameObject sherlockGO = stage.transform.Find("Canvas/SherlockCharacter").gameObject;
@ -116,7 +116,7 @@ public class NarrativeTests : Command
}
else
{
Fail("Characters not found on stage" + stage.charactersOnStage.Count);
Fail("Characters not found on stage" + stage.CharactersOnStage.Count);
}
}
@ -143,8 +143,8 @@ public class NarrativeTests : Command
Character johnCharacter = johnGO.GetComponent<Character>();
Character sherlockCharacter = sherlockGO.GetComponent<Character>();
if (johnCharacter.portraitsFace == FacingDirection.Right &&
sherlockCharacter.portraitsFace == FacingDirection.Left)
if (johnCharacter.PortraitsFace == FacingDirection.Right &&
sherlockCharacter.PortraitsFace == FacingDirection.Left)
{
Pass();
}
@ -222,8 +222,8 @@ public class NarrativeTests : Command
protected virtual void TestResetNoDelay()
{
// Set the stage durations to 0 so we can rerun the tests in this case
stage.fadeDuration = 0f;
stage.moveDuration = 0f;
stage.FadeDuration = 0f;
stage.MoveDuration = 0f;
}
public override string GetSummary()

118
Assets/Tests/Narrative/NarrativeTests.unity

@ -117,7 +117,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3}
m_Name:
m_EditorClassIdentifier:
selectedFlowchart: {fileID: 250457565}
selectedFlowchart: {fileID: 736071350}
--- !u!4 &11556238
Transform:
m_ObjectHideFlags: 1
@ -550,7 +550,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
storyText: 'wi test{m=DoTest}{wi}
@ -669,7 +668,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -715,7 +713,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 4
errorMessage:
indentLevel: 0
targetObject: {fileID: 1066357890}
targetComponentAssemblyName: Fungus.DialogInput, Assembly-CSharp, Version=0.0.0.0,
@ -754,7 +751,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 7
errorMessage:
indentLevel: 0
targetObject: {fileID: 1066357890}
targetComponentAssemblyName: Fungus.DialogInput, Assembly-CSharp, Version=0.0.0.0,
@ -781,7 +777,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -799,7 +794,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 9
errorMessage:
indentLevel: 0
targetObject: {fileID: 1066357890}
targetComponentAssemblyName: Fungus.DialogInput, Assembly-CSharp, Version=0.0.0.0,
@ -826,7 +820,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 8
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -844,7 +837,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 10
errorMessage:
indentLevel: 0
storyText: Wait for click off{m=DoTest}
description:
@ -893,7 +885,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 12
errorMessage:
indentLevel: 0
targetObject: {fileID: 401634244}
targetComponentAssemblyName: SayTest, Assembly-CSharp, Version=0.0.0.0, Culture=neutral,
@ -933,7 +924,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 14
errorMessage:
indentLevel: 0
sayDialog: {fileID: 1066357895}
--- !u!1 &28716239
@ -2690,7 +2680,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
text: Test {$StringVar}
description:
@ -2789,7 +2778,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 2
errorMessage:
indentLevel: 0
menuDialog: {fileID: 1393368593}
--- !u!1 &254519489
@ -3734,7 +3722,6 @@ MonoBehaviour:
fadeDuration: 0.75
moveDuration: 1
fadeEaseType: 4
moveEaseType: 4
shiftOffset: {x: 0, y: 0}
defaultPosition: {fileID: 254519491}
positions:
@ -3744,7 +3731,6 @@ MonoBehaviour:
- {fileID: 1049860613}
- {fileID: 813974793}
cachedPositions: []
charactersOnStage: []
--- !u!1 &499706539
GameObject:
m_ObjectHideFlags: 0
@ -3946,7 +3932,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 4
errorMessage:
indentLevel: 0
text: Option 2
description:
@ -4012,7 +3997,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
text: Option 1
description:
@ -4046,7 +4030,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
menuDialog: {fileID: 231990862}
--- !u!114 &562609153
@ -4127,7 +4110,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -4145,7 +4127,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 7
errorMessage:
indentLevel: 0
menuDialog: {fileID: 231990862}
--- !u!1 &572306878
@ -5060,7 +5041,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
storyText: Write a bit of text that takes a couple of seconds to write out to the
dialog.
@ -5163,7 +5143,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 4
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -5193,7 +5172,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 3
errorMessage:
indentLevel: 0
storyText: Interrupted
description:
@ -5243,7 +5221,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
sayDialog: {fileID: 1764227332}
--- !u!1 &674815458
@ -5717,7 +5694,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -5747,7 +5723,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
--- !u!114 &711866620
MonoBehaviour:
@ -5761,7 +5736,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 3
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -5791,7 +5765,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -6059,7 +6032,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
storyText: 'Play sound effect from dialog{wc}
@ -6142,8 +6114,9 @@ MonoBehaviour:
y: -350
width: 1121
height: 870
selectedBlock: {fileID: 0}
selectedCommands: []
selectedBlock: {fileID: 736071349}
selectedCommands:
- {fileID: 736071366}
variables: []
description: 'Manual test to check if portrait images that are
@ -6182,7 +6155,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 2
errorMessage:
indentLevel: 0
storyText: Play voice over audio clip
description:
@ -6208,7 +6180,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
targetObject: {fileID: 1714427702}
targetComponentAssemblyName: Fungus.DialogInput, Assembly-CSharp, Version=0.0.0.0,
@ -6235,7 +6206,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -6285,7 +6255,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 8
errorMessage:
indentLevel: 0
targetObject: {fileID: 1714427702}
targetComponentAssemblyName: Fungus.DialogInput, Assembly-CSharp, Version=0.0.0.0,
@ -6312,7 +6281,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 7
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -6342,7 +6310,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 3
errorMessage:
indentLevel: 0
sayDialog: {fileID: 1714427708}
--- !u!114 &736071360
@ -6357,7 +6324,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 9
errorMessage:
indentLevel: 0
storyText: Test sound effect specified per character
description:
@ -6383,7 +6349,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 11
errorMessage:
indentLevel: 0
targetObject: {fileID: 1714427702}
targetComponentAssemblyName: Fungus.DialogInput, Assembly-CSharp, Version=0.0.0.0,
@ -6410,7 +6375,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 10
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -6428,7 +6392,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 13
errorMessage:
indentLevel: 0
targetObject: {fileID: 1714427702}
targetComponentAssemblyName: Fungus.DialogInput, Assembly-CSharp, Version=0.0.0.0,
@ -6455,7 +6418,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 12
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -6473,7 +6435,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 15
errorMessage:
indentLevel: 0
storyText: Write some audio with beep sounds
description:
@ -6499,7 +6460,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 14
errorMessage:
indentLevel: 0
targetObject: {fileID: 1714427702}
targetComponentAssemblyName: Fungus.WriterAudio, Assembly-CSharp, Version=0.0.0.0,
@ -6543,7 +6503,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 17
errorMessage:
indentLevel: 0
targetObject: {fileID: 1714427702}
targetComponentAssemblyName: Fungus.DialogInput, Assembly-CSharp, Version=0.0.0.0,
@ -6570,7 +6529,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 16
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -7447,7 +7405,6 @@ MonoBehaviour:
fadeDuration: 0.75
moveDuration: 1
fadeEaseType: 4
moveEaseType: 4
shiftOffset: {x: 0, y: 0}
defaultPosition: {fileID: 879247671}
positions:
@ -7457,7 +7414,6 @@ MonoBehaviour:
- {fileID: 1336986580}
- {fileID: 1754947673}
cachedPositions: []
charactersOnStage: []
--- !u!4 &825247592
Transform:
m_ObjectHideFlags: 0
@ -7764,7 +7720,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 2
errorMessage:
indentLevel: 0
sayDialog: {fileID: 1125936944}
--- !u!114 &861253875
@ -7804,7 +7759,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
storyText: Write out a long piece of text that we want to interrupt before it's
finished.
@ -7867,7 +7821,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 7
errorMessage:
indentLevel: 0
targetObject: {fileID: 1125936939}
targetComponentAssemblyName: Fungus.SayDialog, Assembly-CSharp, Version=0.0.0.0,
@ -7894,7 +7847,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -8323,7 +8275,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 33
errorMessage:
indentLevel: 0
targetFlowchart: {fileID: 0}
targetBlock: {fileID: 891159676}
@ -8341,7 +8292,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 35
errorMessage:
indentLevel: 0
testType: 6
--- !u!114 &891159648
@ -8356,7 +8306,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 34
errorMessage:
indentLevel: 0
targetFlowchart: {fileID: 0}
targetBlock: {fileID: 891159676}
@ -8374,7 +8323,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 36
errorMessage:
indentLevel: 0
storyText: Test saying something{x}
description:
@ -8400,7 +8348,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 47
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -8432,7 +8379,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 46
errorMessage:
indentLevel: 0
display: 2
stage: {fileID: 0}
@ -8452,7 +8398,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 45
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -8472,7 +8417,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 44
errorMessage:
indentLevel: 0
display: 2
stage: {fileID: 0}
@ -8492,7 +8436,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 48
errorMessage:
indentLevel: 0
targetFlowchart: {fileID: 0}
targetBlock: {fileID: 891159644}
@ -8510,7 +8453,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 49
errorMessage:
indentLevel: 0
sayDialog: {fileID: 1090798156}
--- !u!114 &891159661
@ -8525,7 +8467,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 32
errorMessage:
indentLevel: 0
testType: 5
--- !u!114 &891159662
@ -8540,7 +8481,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 31
errorMessage:
indentLevel: 0
storyText: Test saying something{x}
description:
@ -8566,7 +8506,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 30
errorMessage:
indentLevel: 0
testType: 4
--- !u!114 &891159664
@ -8581,7 +8520,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 29
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -8611,7 +8549,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 28
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -8641,7 +8578,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 27
errorMessage:
indentLevel: 0
testType: 3
--- !u!114 &891159667
@ -8656,7 +8592,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 26
errorMessage:
indentLevel: 0
display: 4
stage: {fileID: 0}
@ -8686,7 +8621,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 25
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -8716,7 +8650,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 24
errorMessage:
indentLevel: 0
testType: 2
--- !u!114 &891159670
@ -8731,7 +8664,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 23
errorMessage:
indentLevel: 0
display: 3
stage: {fileID: 0}
@ -8761,7 +8693,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 22
errorMessage:
indentLevel: 0
testType: 1
--- !u!114 &891159672
@ -8776,7 +8707,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 21
errorMessage:
indentLevel: 0
display: 2
stage: {fileID: 0}
@ -8806,7 +8736,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 20
errorMessage:
indentLevel: 0
testType: 0
--- !u!114 &891159674
@ -8821,7 +8750,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 19
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -8851,7 +8779,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 18
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -10694,7 +10621,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
storyText: A long piece of text that takes a while to write out
description:
@ -10798,7 +10724,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 2
errorMessage:
indentLevel: 0
sayDialog: {fileID: 1792345322}
--- !u!1 &1083481054
@ -11866,7 +11791,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
storyText: Block A
description:
@ -11969,7 +11893,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
storyText: Block B
description:
@ -11995,7 +11918,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 4
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -12013,7 +11935,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 3
errorMessage:
indentLevel: 0
targetFlowchart: {fileID: 0}
targetBlock: {fileID: 1196429433}
@ -12055,7 +11976,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
sayDialog: {fileID: 1242507978}
--- !u!114 &1210810389
@ -13346,7 +13266,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 3
errorMessage:
indentLevel: 0
--- !u!114 &1555865763
MonoBehaviour:
@ -13383,7 +13302,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
text: DoOption
description:
@ -15230,7 +15148,7 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_RotationOrder: 0
spreadCustomCurve:
serializedVersion: 2
m_Curve:
@ -15252,7 +15170,7 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_RotationOrder: 0
--- !u!114 &1714427706
MonoBehaviour:
m_ObjectHideFlags: 0
@ -16411,7 +16329,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 4
errorMessage:
indentLevel: 0
--- !u!114 &1807695775
MonoBehaviour:
@ -16426,7 +16343,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 3
errorMessage:
indentLevel: 0
storyText: '{s=40}
@ -16463,7 +16379,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
storyText: '{s=40}
@ -16578,7 +16493,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
sayDialog: {fileID: 927439921}
--- !u!1 &1837434062
@ -16818,7 +16732,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
storyText: A long block of text that runs all the way to the end of the text box{w=1}{x}
description:
@ -16889,7 +16802,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 2
errorMessage:
indentLevel: 0
sayDialog: {fileID: 1508308453}
--- !u!114 &1913435025
@ -16904,7 +16816,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 4
errorMessage:
indentLevel: 0
storyText: A long block of text that runs all the way to the end of the text box{w=1}{x}
description:
@ -16930,7 +16841,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 3
errorMessage:
indentLevel: 0
sayDialog: {fileID: 538232720}
--- !u!114 &1913435027
@ -16945,7 +16855,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
storyText: No character. A long block of text that runs all the way to the end of
the text box{w=1}{x}
@ -16972,7 +16881,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
storyText: No character. A long block of text that runs all the way to the end of
the text box{w=1}{x}
@ -16999,7 +16907,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 10
errorMessage:
indentLevel: 0
targetObject: {fileID: 392887984}
targetComponentAssemblyName: OverlapTests, Assembly-CSharp, Version=0.0.0.0, Culture=neutral,
@ -17026,7 +16933,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 9
errorMessage:
indentLevel: 0
targetObject: {fileID: 392887984}
targetComponentAssemblyName: OverlapTests, Assembly-CSharp, Version=0.0.0.0, Culture=neutral,
@ -17053,7 +16959,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 8
errorMessage:
indentLevel: 0
targetObject: {fileID: 392887984}
targetComponentAssemblyName: OverlapTests, Assembly-CSharp, Version=0.0.0.0, Culture=neutral,
@ -17080,7 +16985,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 7
errorMessage:
indentLevel: 0
targetObject: {fileID: 392887984}
targetComponentAssemblyName: OverlapTests, Assembly-CSharp, Version=0.0.0.0, Culture=neutral,
@ -17110,7 +17014,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &1929911610
Transform:
m_ObjectHideFlags: 0
@ -17576,7 +17480,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
textObject: {fileID: 588326334}
text:
@ -18326,7 +18229,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -18399,7 +18301,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 2
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -18429,7 +18330,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 3
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -18447,7 +18347,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 5
errorMessage:
indentLevel: 0
display: 1
stage: {fileID: 0}
@ -18477,7 +18376,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 4
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}
@ -18495,7 +18393,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
--- !u!114 &2043226680
MonoBehaviour:
@ -18509,7 +18406,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
itemId: 7
errorMessage:
indentLevel: 0
_duration:
floatRef: {fileID: 0}

16
Assets/Tests/Narrative/OverlapTests.cs

@ -14,12 +14,12 @@ public class OverlapTests : MonoBehaviour
public void Step1()
{
if (!sayDialog_RightImage.characterImage.IsActive())
if (!sayDialog_RightImage.CharacterImage.IsActive())
{
IntegrationTest.Fail("Character image not active");
}
if (sayDialog_RightImage.characterImage.transform.position.x < sayDialog_RightImage.storyText.transform.position.x)
if (sayDialog_RightImage.CharacterImage.transform.position.x < sayDialog_RightImage.StoryText.transform.position.x)
{
IntegrationTest.Fail("Character image not on right hand side");
}
@ -27,12 +27,12 @@ public class OverlapTests : MonoBehaviour
public void Step2()
{
if (sayDialog_RightImage.characterImage.IsActive())
if (sayDialog_RightImage.CharacterImage.IsActive())
{
IntegrationTest.Fail("Character image should not be active");
}
float width = sayDialog_RightImage.storyText.rectTransform.rect.width;
float width = sayDialog_RightImage.StoryText.rectTransform.rect.width;
if (!Mathf.Approximately(width, 1439))
{
IntegrationTest.Fail("Story text width not correct");
@ -41,12 +41,12 @@ public class OverlapTests : MonoBehaviour
public void Step3()
{
if (!sayDialog_LeftImage.characterImage.IsActive())
if (!sayDialog_LeftImage.CharacterImage.IsActive())
{
IntegrationTest.Fail("Character image not active");
}
if (sayDialog_LeftImage.characterImage.transform.position.x > sayDialog_LeftImage.storyText.transform.position.x)
if (sayDialog_LeftImage.CharacterImage.transform.position.x > sayDialog_LeftImage.StoryText.transform.position.x)
{
IntegrationTest.Fail("Character image not on left hand side");
}
@ -54,12 +54,12 @@ public class OverlapTests : MonoBehaviour
public void Step4()
{
if (sayDialog_LeftImage.characterImage.IsActive())
if (sayDialog_LeftImage.CharacterImage.IsActive())
{
IntegrationTest.Fail("Character image should not be active");
}
float width = sayDialog_LeftImage.storyText.rectTransform.rect.width;
float width = sayDialog_LeftImage.StoryText.rectTransform.rect.width;
if (!Mathf.Approximately(width, 1439))
{
IntegrationTest.Fail("Story text width not correct");

24
ProjectSettings/GraphicsSettings.asset

@ -39,20 +39,20 @@ GraphicsSettings:
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
m_ShaderSettings_Tier1:
useCascadedShadowMaps: 0
standardShaderQuality: 0
useReflectionProbeBoxProjection: 0
useReflectionProbeBlending: 0
useCascadedShadowMaps: 1
standardShaderQuality: 2
useReflectionProbeBoxProjection: 1
useReflectionProbeBlending: 1
m_ShaderSettings_Tier2:
useCascadedShadowMaps: 0
standardShaderQuality: 1
useReflectionProbeBoxProjection: 0
useReflectionProbeBlending: 0
useCascadedShadowMaps: 1
standardShaderQuality: 2
useReflectionProbeBoxProjection: 1
useReflectionProbeBlending: 1
m_ShaderSettings_Tier3:
useCascadedShadowMaps: 0
standardShaderQuality: 1
useReflectionProbeBoxProjection: 0
useReflectionProbeBlending: 0
useCascadedShadowMaps: 1
standardShaderQuality: 2
useReflectionProbeBoxProjection: 1
useReflectionProbeBlending: 1
m_BuildTargetShaderSettings: []
m_LightmapStripping: 0
m_FogStripping: 0

Loading…
Cancel
Save