From 0cc280cddb5581dcde2d0031ad0439372bbe3d04 Mon Sep 17 00:00:00 2001 From: morningfungame Date: Fri, 3 Mar 2017 01:00:17 +0800 Subject: [PATCH 2/2] Add portrait DimColor --- Assets/Fungus/Scripts/Components/PortraitController.cs | 6 +++--- Assets/Fungus/Scripts/Components/Stage.cs | 8 ++++++++ Assets/Tests/Narrative/ConversationTests.unity | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Assets/Fungus/Scripts/Components/PortraitController.cs b/Assets/Fungus/Scripts/Components/PortraitController.cs index 64ccc72e..47c2fc9b 100644 --- a/Assets/Fungus/Scripts/Components/PortraitController.cs +++ b/Assets/Fungus/Scripts/Components/PortraitController.cs @@ -32,7 +32,7 @@ namespace Fungus public enum FacingDirection { /// Unknown direction - None, + None, /// Facing left. Left, /// Facing right. @@ -605,14 +605,14 @@ namespace Fungus character.State.dimmed = dimmedState; - Color targetColor = dimmedState ? new Color(0.5f, 0.5f, 0.5f, 1f) : Color.white; + Color targetColor = dimmedState ? stage.DimColor : Color.white; // LeanTween doesn't handle 0 duration properly float duration = (stage.FadeDuration > 0f) ? stage.FadeDuration : float.Epsilon; LeanTween.color(character.State.portraitImage.rectTransform, targetColor, duration).setEase(stage.FadeEaseType); } - + #endregion } } diff --git a/Assets/Fungus/Scripts/Components/Stage.cs b/Assets/Fungus/Scripts/Components/Stage.cs index c34887e8..2a0d9869 100644 --- a/Assets/Fungus/Scripts/Components/Stage.cs +++ b/Assets/Fungus/Scripts/Components/Stage.cs @@ -20,6 +20,9 @@ namespace Fungus [Tooltip("Dim portraits when a character is not speaking.")] [SerializeField] protected bool dimPortraits; + [Tooltip("Choose a dimColor")] + [SerializeField] protected Color dimColor =new Color(0.5f, 0.5f, 0.5f, 1f); + [Tooltip("Duration for fading character portraits in / out.")] [SerializeField] protected float fadeDuration = 0.5f; @@ -96,6 +99,11 @@ namespace Fungus /// public virtual bool DimPortraits { get { return dimPortraits; } set { dimPortraits = value; } } + /// + /// Choose a dimColor. + /// + public virtual Color DimColor { get { return dimColor; } set { dimColor = value; } } + /// /// Duration for fading character portraits in / out. /// diff --git a/Assets/Tests/Narrative/ConversationTests.unity b/Assets/Tests/Narrative/ConversationTests.unity index 3bf888a1..6c6f3e04 100644 --- a/Assets/Tests/Narrative/ConversationTests.unity +++ b/Assets/Tests/Narrative/ConversationTests.unity @@ -737,7 +737,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!114 &215354033 MonoBehaviour: m_ObjectHideFlags: 0 @@ -4165,6 +4165,7 @@ MonoBehaviour: m_EditorClassIdentifier: portraitCanvas: {fileID: 191157555} dimPortraits: 1 + dimColor: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 1} fadeDuration: 0.75 moveDuration: 1 fadeEaseType: 4