From d94695af853eaf55e91537123c1d9a4409a1524f Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Mon, 30 Jul 2018 19:46:14 +0900 Subject: [PATCH] close #78; Remove 'cutoff' and 'mono' effect in UIEffect component --- .../UIExtensions/UIEffect/Scripts/UIEffect.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Assets/Coffee/UIExtensions/UIEffect/Scripts/UIEffect.cs b/Assets/Coffee/UIExtensions/UIEffect/Scripts/UIEffect.cs index 4af16367..94421295 100644 --- a/Assets/Coffee/UIExtensions/UIEffect/Scripts/UIEffect.cs +++ b/Assets/Coffee/UIExtensions/UIEffect/Scripts/UIEffect.cs @@ -349,6 +349,22 @@ protected override void UpgradeIfNeeded() hsv.hue = hue; hsv.range = 1; } + + if (m_ToneMode == ToneMode.Cutoff || m_ToneMode == ToneMode.Mono) + { + var go = gameObject; + var factor = m_ToneLevel; + var transitionMode = m_ToneMode == ToneMode.Cutoff + ? UITransitionEffect.EffectMode.Cutoff + : UITransitionEffect.EffectMode.Mono; + DestroyImmediate(this, true); + var trans = go.GetComponent() ?? go.AddComponent(); + trans.effectFactor = factor; + + var sp = new SerializedObject(trans).FindProperty("m_EffectMode"); + sp.intValue = (int)transitionMode; + sp.serializedObject.ApplyModifiedProperties(); + } } } #pragma warning restore 0612