mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-19 17:22:37 +08:00
feat: add v4 compatible components
Use these components for an easy upgrade to v5 with minimal changes.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69f569585a2b5439b830cc115efdf867
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff0fce2b92cd14619a005b01cdb16ae2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f85254e18b3848ebbda5287000b7644
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,136 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Coffee.UIEffectInternal;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// Effect player.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class EffectPlayer
|
||||
{
|
||||
//################################
|
||||
// Public Members.
|
||||
//################################
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether is playing.
|
||||
/// </summary>
|
||||
[Header("Effect Player")]
|
||||
[Tooltip("Playing.")]
|
||||
public bool play = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the delay before looping.
|
||||
/// </summary>
|
||||
[Tooltip("Initial play delay.")]
|
||||
[Range(0f, 10f)]
|
||||
public float initialPlayDelay = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the duration.
|
||||
/// </summary>
|
||||
[Tooltip("Duration.")]
|
||||
[Range(0.01f, 10f)]
|
||||
public float duration = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether can loop.
|
||||
/// </summary>
|
||||
[Tooltip("Loop.")]
|
||||
public bool loop = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the delay before looping.
|
||||
/// </summary>
|
||||
[Tooltip("Delay before looping.")]
|
||||
[Range(0f, 10f)]
|
||||
public float loopDelay = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the update mode.
|
||||
/// </summary>
|
||||
[Tooltip("Update mode")]
|
||||
public AnimatorUpdateMode updateMode = AnimatorUpdateMode.Normal;
|
||||
|
||||
private UIEffectTweener _tweener;
|
||||
private UIEffectBase _target;
|
||||
|
||||
/// <summary>
|
||||
/// Register player.
|
||||
/// </summary>
|
||||
public void OnEnable()
|
||||
{
|
||||
if (play)
|
||||
{
|
||||
Play(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregister player.
|
||||
/// </summary>
|
||||
public void OnDisable()
|
||||
{
|
||||
Stop(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start playing.
|
||||
/// </summary>
|
||||
public void Play(bool reset)
|
||||
{
|
||||
play = true;
|
||||
SetupProperty();
|
||||
if (reset && _tweener)
|
||||
{
|
||||
_tweener.direction = UIEffectTweener.Direction.Forward;
|
||||
_tweener.SetTime(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayReverse(bool reset)
|
||||
{
|
||||
play = true;
|
||||
SetupProperty();
|
||||
if (reset && _tweener)
|
||||
{
|
||||
_tweener.direction = UIEffectTweener.Direction.Reverse;
|
||||
_tweener.SetTime(_tweener.totalTime);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop playing.
|
||||
/// </summary>
|
||||
public void Stop(bool reset)
|
||||
{
|
||||
play = false;
|
||||
if (reset && _tweener)
|
||||
{
|
||||
SetupProperty();
|
||||
_tweener.SetTime(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void Attach(UIEffectBase target)
|
||||
{
|
||||
_target = target;
|
||||
SetupProperty();
|
||||
}
|
||||
|
||||
private void SetupProperty()
|
||||
{
|
||||
if (!_target) return;
|
||||
_tweener = _target.GetOrAddComponent<UIEffectTweener>();
|
||||
_tweener.enabled = play;
|
||||
_tweener.duration = duration;
|
||||
_tweener.wrapMode = loop ? UIEffectTweener.WrapMode.Loop : UIEffectTweener.WrapMode.Once;
|
||||
_tweener.interval = loopDelay;
|
||||
_tweener.delay = initialPlayDelay;
|
||||
_tweener.updateMode = updateMode == AnimatorUpdateMode.UnscaledTime
|
||||
? UIEffectTweener.UpdateMode.Unscaled
|
||||
: UIEffectTweener.UpdateMode.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1656fb67110cd44298010d95c324e87a
|
||||
timeCreated: 1528296875
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
#if UNITY_EDITOR
|
||||
using System.Linq;
|
||||
using Coffee.UIEffectInternal;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
internal static class UIEffectV4Editor
|
||||
{
|
||||
[MenuItem("CONTEXT/" + nameof(UIDissolve) + "/Convert To UIEffect")]
|
||||
[MenuItem("CONTEXT/" + nameof(UIShiny) + "/Convert To UIEffect")]
|
||||
[MenuItem("CONTEXT/" + nameof(UIHsvModifier) + "/Convert To UIEffect")]
|
||||
[MenuItem("CONTEXT/" + nameof(UITransitionEffect) + "/Convert To UIEffect")]
|
||||
[MenuItem("CONTEXT/" + nameof(UIEffectV4) + "/Convert To UIEffect")]
|
||||
private static void ConvertToUIEffect(MenuCommand command)
|
||||
{
|
||||
if (command.context is UIEffectBase legacy)
|
||||
{
|
||||
var go = legacy.gameObject;
|
||||
var legacyContext = legacy.context;
|
||||
command.context.ConvertTo<UIEffect>();
|
||||
go.GetComponent<UIEffect>().CopyFrom(legacyContext);
|
||||
}
|
||||
}
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
private static void InitializeOnLoad()
|
||||
{
|
||||
var presets = new[]
|
||||
{
|
||||
"3b09ad143990c4c8795c6e93760e132a",
|
||||
"4f70ff0f1e25b4388b9bcb38d619f7bf"
|
||||
}
|
||||
.Select(AssetDatabase.GUIDToAssetPath)
|
||||
.Select(AssetDatabase.LoadAssetAtPath<UIEffect>);
|
||||
foreach (var preset in presets)
|
||||
{
|
||||
UIEffectProjectSettings.RegisterRuntimePreset(preset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07594cda8b77140ea9d1ea25bc6aeb0d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78cc1478fd16a484ba11857d5c4f4912
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// Blur effect mode.
|
||||
/// </summary>
|
||||
public enum BlurMode
|
||||
{
|
||||
None = 0,
|
||||
FastBlur = 1,
|
||||
MediumBlur = 2,
|
||||
DetailBlur = 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5645838b01af8764d8f381f04b62b9a2
|
||||
timeCreated: 1528296875
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// Color effect mode.
|
||||
/// </summary>
|
||||
public enum ColorMode
|
||||
{
|
||||
Multiply = 0,
|
||||
Fill = 1,
|
||||
Add = 2,
|
||||
Subtract = 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6ba1e487e0a19644afde2bd5531bd04
|
||||
timeCreated: 1528296875
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,155 @@
|
||||
using UnityEngine.Rendering;
|
||||
using static Coffee.UIEffects.SamplingFilter;
|
||||
using static Coffee.UIEffects.ToneFilter;
|
||||
using static Coffee.UIEffects.TransitionFilter;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
internal static class EnumConverter
|
||||
{
|
||||
public static UITransitionEffect.EffectMode Convert(this TransitionFilter mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case Fade: return UITransitionEffect.EffectMode.Fade;
|
||||
case Cutoff: return UITransitionEffect.EffectMode.Cutoff;
|
||||
case Dissolve: return UITransitionEffect.EffectMode.Dissolve;
|
||||
default:
|
||||
return UITransitionEffect.EffectMode.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static TransitionFilter Convert(this UITransitionEffect.EffectMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case UITransitionEffect.EffectMode.Fade: return Fade;
|
||||
case UITransitionEffect.EffectMode.Cutoff: return Cutoff;
|
||||
case UITransitionEffect.EffectMode.Dissolve: return Dissolve;
|
||||
default: return TransitionFilter.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static ColorFilter Convert(this ColorMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case ColorMode.Add: return ColorFilter.Additive;
|
||||
case ColorMode.Subtract: return ColorFilter.Subtractive;
|
||||
case ColorMode.Fill: return ColorFilter.Replace;
|
||||
default: return ColorFilter.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static ColorMode Convert(this ColorFilter filter)
|
||||
{
|
||||
switch (filter)
|
||||
{
|
||||
case ColorFilter.Additive: return ColorMode.Add;
|
||||
case ColorFilter.Subtractive: return ColorMode.Subtract;
|
||||
case ColorFilter.Replace: return ColorMode.Fill;
|
||||
default: return ColorMode.Multiply;
|
||||
}
|
||||
}
|
||||
|
||||
public static (ToneFilter, SamplingFilter) Convert(this EffectMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case EffectMode.Grayscale: return (Grayscale, SamplingFilter.None);
|
||||
case EffectMode.Sepia: return (Sepia, SamplingFilter.None);
|
||||
case EffectMode.Nega: return (Negative, SamplingFilter.None);
|
||||
case EffectMode.Pixel: return (ToneFilter.None, Pixelation);
|
||||
default: return (ToneFilter.None, SamplingFilter.None);
|
||||
}
|
||||
}
|
||||
|
||||
public static (ToneFilter, SamplingFilter) Convert(this (EffectMode effectMode, BlurMode blurMode) mode)
|
||||
{
|
||||
switch (mode.effectMode)
|
||||
{
|
||||
case EffectMode.Grayscale: return (Grayscale, mode.blurMode.Convert());
|
||||
case EffectMode.Sepia: return (Sepia, mode.blurMode.Convert());
|
||||
case EffectMode.Nega: return (Negative, mode.blurMode.Convert());
|
||||
case EffectMode.Pixel: return (ToneFilter.None, Pixelation);
|
||||
default: return (ToneFilter.None, mode.blurMode.Convert());
|
||||
}
|
||||
}
|
||||
|
||||
public static EffectMode Convert(this (ToneFilter, SamplingFilter) filter)
|
||||
{
|
||||
if (filter.Item2 == Pixelation)
|
||||
{
|
||||
return EffectMode.Pixel;
|
||||
}
|
||||
|
||||
switch (filter.Item1)
|
||||
{
|
||||
case Grayscale: return EffectMode.Grayscale;
|
||||
case Sepia: return EffectMode.Sepia;
|
||||
case Negative: return EffectMode.Nega;
|
||||
default: return EffectMode.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static BlurMode Convert(this SamplingFilter filter)
|
||||
{
|
||||
switch (filter)
|
||||
{
|
||||
case BlurFast: return BlurMode.FastBlur;
|
||||
case BlurDetail: return BlurMode.DetailBlur;
|
||||
default: return BlurMode.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static SamplingFilter Convert(this BlurMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case BlurMode.FastBlur: return BlurFast;
|
||||
case BlurMode.MediumBlur: return BlurDetail;
|
||||
case BlurMode.DetailBlur: return BlurDetail;
|
||||
default: return SamplingFilter.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static ShadowMode Convert(this ShadowStyle style)
|
||||
{
|
||||
switch (style)
|
||||
{
|
||||
case ShadowStyle.Shadow: return ShadowMode.Shadow;
|
||||
case ShadowStyle.Outline: return ShadowMode.Outline;
|
||||
case ShadowStyle.Outline8: return ShadowMode.Outline8;
|
||||
case ShadowStyle.Shadow3: return ShadowMode.Shadow3;
|
||||
default: return ShadowMode.None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public static (BlendMode, BlendMode) Convert(this (BlendType type, BlendMode src, BlendMode dst) self)
|
||||
// {
|
||||
// return self.type switch
|
||||
// {
|
||||
// BlendType.AlphaBlend => (BlendMode.One, BlendMode.OneMinusSrcAlpha),
|
||||
// BlendType.Multiply => (BlendMode.DstColor, BlendMode.OneMinusSrcAlpha),
|
||||
// BlendType.Additive => (BlendMode.One, BlendMode.One),
|
||||
// BlendType.SoftAdditive => (BlendMode.OneMinusDstColor, BlendMode.One),
|
||||
// BlendType.MultiplyAdditive => (BlendMode.DstColor, BlendMode.One),
|
||||
// _ => (self.src, self.dst)
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// public static BlendType Convert(this (BlendMode src, BlendMode dst) self)
|
||||
// {
|
||||
// return self switch
|
||||
// {
|
||||
// (BlendMode.One, BlendMode.OneMinusSrcAlpha) => BlendType.AlphaBlend,
|
||||
// (BlendMode.DstColor, BlendMode.OneMinusSrcAlpha) => BlendType.Multiply,
|
||||
// (BlendMode.One, BlendMode.One) => BlendType.Additive,
|
||||
// (BlendMode.OneMinusDstColor, BlendMode.One) => BlendType.SoftAdditive,
|
||||
// (BlendMode.DstColor, BlendMode.One) => BlendType.MultiplyAdditive,
|
||||
// _ => BlendType.Custom
|
||||
// };
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f797a494ddf546e8812a1ba38a45b0f
|
||||
timeCreated: 1528296875
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
public enum EffectArea
|
||||
{
|
||||
RectTransform,
|
||||
Fit,
|
||||
Character,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a78f43d1382a048a99411472ca714e1b
|
||||
timeCreated: 1528636556
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// Effect mode.
|
||||
/// </summary>
|
||||
public enum EffectMode
|
||||
{
|
||||
None = 0,
|
||||
Grayscale = 1,
|
||||
Sepia = 2,
|
||||
Nega = 3,
|
||||
Pixel = 4
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 092769547c242d74cbad96631a00963f
|
||||
timeCreated: 1528296875
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// Shadow effect style.
|
||||
/// </summary>
|
||||
public enum ShadowStyle
|
||||
{
|
||||
None = 0,
|
||||
Shadow,
|
||||
Outline,
|
||||
Outline8,
|
||||
Shadow3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0eda5bf10146491c9cfe6a31c66f9a7
|
||||
timeCreated: 1528296875
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0be47422b0f5f48c7a3ce3ddb24c467d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[CustomEditor(typeof(ObsoleteMonoBehaviour), true)]
|
||||
internal class ObsoleteMonoBehaviourEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.HelpBox("This component is obsolete.", MessageType.Warning);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public abstract class ObsoleteMonoBehaviour : MonoBehaviour
|
||||
{
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edf39759db7d24b13b6c110965fb3125
|
||||
timeCreated: 1485321967
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -400
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(Graphic))]
|
||||
[AddComponentMenu("")]
|
||||
public class UIFlip : ObsoleteMonoBehaviour
|
||||
{
|
||||
[Tooltip("Flip horizontally.")]
|
||||
[SerializeField]
|
||||
private bool m_Horizontal = false;
|
||||
|
||||
[Tooltip("Flip vertically.")]
|
||||
[SerializeField]
|
||||
private bool m_Veritical = false;
|
||||
|
||||
public bool horizontal
|
||||
{
|
||||
get => m_Horizontal;
|
||||
set
|
||||
{
|
||||
if (m_Horizontal == value) return;
|
||||
m_Horizontal = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool vertical
|
||||
{
|
||||
get => m_Veritical;
|
||||
set
|
||||
{
|
||||
if (m_Veritical == value) return;
|
||||
m_Veritical = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bb4e59514e90489d985e9a17c838085
|
||||
timeCreated: 1525607243
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+198
@@ -0,0 +1,198 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[RequireComponent(typeof(Graphic))]
|
||||
[AddComponentMenu("")]
|
||||
public class UIGradient : ObsoleteMonoBehaviour
|
||||
{
|
||||
public enum Direction
|
||||
{
|
||||
Horizontal,
|
||||
Vertical,
|
||||
Angle,
|
||||
Diagonal,
|
||||
}
|
||||
|
||||
public enum GradientStyle
|
||||
{
|
||||
Rect,
|
||||
Fit,
|
||||
Split,
|
||||
}
|
||||
|
||||
[Tooltip("Gradient Direction.")]
|
||||
[SerializeField]
|
||||
private Direction m_Direction;
|
||||
|
||||
[Tooltip("Color1: Top or Left.")]
|
||||
[SerializeField]
|
||||
private Color m_Color1 = Color.white;
|
||||
|
||||
[Tooltip("Color2: Bottom or Right.")]
|
||||
[SerializeField]
|
||||
private Color m_Color2 = Color.white;
|
||||
|
||||
[Tooltip("Color3: For diagonal.")]
|
||||
[SerializeField]
|
||||
private Color m_Color3 = Color.white;
|
||||
|
||||
[Tooltip("Color4: For diagonal.")]
|
||||
[SerializeField]
|
||||
private Color m_Color4 = Color.white;
|
||||
|
||||
[Tooltip("Gradient rotation.")]
|
||||
[SerializeField]
|
||||
[Range(-180, 180)]
|
||||
private float m_Rotation;
|
||||
|
||||
[Tooltip("Gradient offset for Horizontal, Vertical or Angle.")]
|
||||
[SerializeField]
|
||||
[Range(-1, 1)]
|
||||
private float m_Offset1;
|
||||
|
||||
[Tooltip("Gradient offset for Diagonal.")]
|
||||
[SerializeField]
|
||||
[Range(-1, 1)]
|
||||
private float m_Offset2;
|
||||
|
||||
[Tooltip("Gradient style for Text.")]
|
||||
[SerializeField]
|
||||
private GradientStyle m_GradientStyle;
|
||||
|
||||
[Tooltip("Color space to correct color.")]
|
||||
[SerializeField]
|
||||
private ColorSpace m_ColorSpace = ColorSpace.Uninitialized;
|
||||
|
||||
[Tooltip("Ignore aspect ratio.")]
|
||||
[SerializeField]
|
||||
private bool m_IgnoreAspectRatio = true;
|
||||
|
||||
public Direction direction
|
||||
{
|
||||
get => m_Direction;
|
||||
set
|
||||
{
|
||||
if (m_Direction == value) return;
|
||||
m_Direction = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color color1
|
||||
{
|
||||
get => m_Color1;
|
||||
set
|
||||
{
|
||||
if (m_Color1 == value) return;
|
||||
m_Color1 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color color2
|
||||
{
|
||||
get => m_Color2;
|
||||
set
|
||||
{
|
||||
if (m_Color2 == value) return;
|
||||
m_Color2 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color color3
|
||||
{
|
||||
get => m_Color3;
|
||||
set
|
||||
{
|
||||
if (m_Color3 == value) return;
|
||||
m_Color3 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color color4
|
||||
{
|
||||
get => m_Color4;
|
||||
set
|
||||
{
|
||||
if (m_Color4 == value) return;
|
||||
m_Color4 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float rotation
|
||||
{
|
||||
get => m_Direction == Direction.Horizontal ? -90
|
||||
: m_Direction == Direction.Vertical ? 0
|
||||
: m_Rotation;
|
||||
set
|
||||
{
|
||||
if (Mathf.Approximately(m_Rotation, value)) return;
|
||||
m_Rotation = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float offset
|
||||
{
|
||||
get => m_Offset1;
|
||||
set
|
||||
{
|
||||
if (Mathf.Approximately(m_Offset1, value)) return;
|
||||
m_Offset1 = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gradient offset for Diagonal.
|
||||
/// </summary>
|
||||
public Vector2 offset2
|
||||
{
|
||||
get => new Vector2(m_Offset2, m_Offset1);
|
||||
set
|
||||
{
|
||||
if (Mathf.Approximately(m_Offset1, value.y) && Mathf.Approximately(m_Offset2, value.x)) return;
|
||||
m_Offset1 = value.y;
|
||||
m_Offset2 = value.x;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gradient style for Text.
|
||||
/// </summary>
|
||||
public GradientStyle gradientStyle
|
||||
{
|
||||
get => m_GradientStyle;
|
||||
set
|
||||
{
|
||||
if (m_GradientStyle == value) return;
|
||||
m_GradientStyle = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Color space to correct color.
|
||||
/// </summary>
|
||||
public ColorSpace colorSpace
|
||||
{
|
||||
get => m_ColorSpace;
|
||||
set
|
||||
{
|
||||
if (m_ColorSpace == value) return;
|
||||
m_ColorSpace = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ignore aspect ratio.
|
||||
/// </summary>
|
||||
public bool ignoreAspectRatio
|
||||
{
|
||||
get => m_IgnoreAspectRatio;
|
||||
set
|
||||
{
|
||||
if (m_IgnoreAspectRatio == value) return;
|
||||
m_IgnoreAspectRatio = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fb48d82dc0e94a2b9246d17d04f8748
|
||||
timeCreated: 1515744842
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,93 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
[RequireComponent(typeof(Graphic))]
|
||||
[AddComponentMenu("")]
|
||||
public class UIShadow : ObsoleteMonoBehaviour
|
||||
{
|
||||
private const float k_KMaxEffectDistance = 600f;
|
||||
|
||||
[Tooltip("How far is the blurring shadow from the graphic.")]
|
||||
[FormerlySerializedAs("m_Blur")]
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_BlurFactor = 1;
|
||||
|
||||
[Tooltip("Shadow effect style.")]
|
||||
[SerializeField]
|
||||
private ShadowStyle m_Style = ShadowStyle.Shadow;
|
||||
|
||||
[SerializeField]
|
||||
private Color m_EffectColor = new Color(0f, 0f, 0f, 0.5f);
|
||||
|
||||
[SerializeField]
|
||||
private Vector2 m_EffectDistance = new Vector2(1f, -1f);
|
||||
|
||||
[SerializeField]
|
||||
private bool m_UseGraphicAlpha = true;
|
||||
|
||||
public Color effectColor
|
||||
{
|
||||
get => m_EffectColor;
|
||||
set
|
||||
{
|
||||
if (m_EffectColor == value) return;
|
||||
m_EffectColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 effectDistance
|
||||
{
|
||||
get => m_EffectDistance;
|
||||
set
|
||||
{
|
||||
if (value.x > k_KMaxEffectDistance)
|
||||
value.x = k_KMaxEffectDistance;
|
||||
if (value.x < -k_KMaxEffectDistance)
|
||||
value.x = -k_KMaxEffectDistance;
|
||||
|
||||
if (value.y > k_KMaxEffectDistance)
|
||||
value.y = k_KMaxEffectDistance;
|
||||
if (value.y < -k_KMaxEffectDistance)
|
||||
value.y = -k_KMaxEffectDistance;
|
||||
|
||||
if (m_EffectDistance == value) return;
|
||||
m_EffectDistance = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool useGraphicAlpha
|
||||
{
|
||||
get => m_UseGraphicAlpha;
|
||||
set
|
||||
{
|
||||
if (m_UseGraphicAlpha == value) return;
|
||||
m_UseGraphicAlpha = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float blurFactor
|
||||
{
|
||||
get => m_BlurFactor;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 2);
|
||||
if (Mathf.Approximately(m_BlurFactor, value)) return;
|
||||
m_BlurFactor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ShadowStyle style
|
||||
{
|
||||
get => m_Style;
|
||||
set
|
||||
{
|
||||
if (m_Style == value) return;
|
||||
m_Style = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0848bff101191904ead4bb831f7084db
|
||||
timeCreated: 1485321967
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -400
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,246 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// Dissolve effect for uGUI.
|
||||
/// </summary>
|
||||
// [AddComponentMenu("UI/UIEffects/UIDissolve", 3)]
|
||||
public class UIDissolve : UIEffectBase
|
||||
{
|
||||
[Tooltip("Current location[0-1] for dissolve effect. 0 is not dissolved, 1 is completely dissolved.")]
|
||||
[FormerlySerializedAs("m_Location")]
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_EffectFactor = 0.5f;
|
||||
|
||||
[Tooltip("Edge width.")]
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_Width = 0.5f;
|
||||
|
||||
[Tooltip("Edge softness.")]
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_Softness = 0.5f;
|
||||
|
||||
[Tooltip("Edge color.")]
|
||||
[SerializeField]
|
||||
[ColorUsage(false)]
|
||||
private Color m_Color = new Color(0.0f, 0.25f, 1.0f);
|
||||
|
||||
[Tooltip("Edge color effect mode.")]
|
||||
[SerializeField]
|
||||
private ColorMode m_ColorMode = ColorMode.Add;
|
||||
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("m_NoiseTexture")]
|
||||
private Texture m_TransitionTexture;
|
||||
|
||||
[SerializeField]
|
||||
private EffectArea m_EffectArea = EffectArea.RectTransform;
|
||||
|
||||
[Tooltip("Keep effect aspect ratio.")]
|
||||
[SerializeField]
|
||||
private bool m_KeepAspectRatio;
|
||||
|
||||
[Header("Effect Player")] [SerializeField]
|
||||
private EffectPlayer m_Player;
|
||||
|
||||
[Tooltip("Reverse the dissolve effect.")]
|
||||
[FormerlySerializedAs("m_ReverseAnimation")]
|
||||
[SerializeField]
|
||||
private bool m_Reverse = false;
|
||||
|
||||
/// <summary>
|
||||
/// Effect factor between 0(start) and 1(end).
|
||||
/// </summary>
|
||||
public float effectFactor
|
||||
{
|
||||
get => m_EffectFactor;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_EffectFactor, value)) return;
|
||||
|
||||
m_EffectFactor = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edge width.
|
||||
/// </summary>
|
||||
public float width
|
||||
{
|
||||
get => m_Width;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_Width, value)) return;
|
||||
|
||||
m_Width = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edge softness.
|
||||
/// </summary>
|
||||
public float softness
|
||||
{
|
||||
get => m_Softness;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_Softness, value)) return;
|
||||
|
||||
m_Softness = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edge color.
|
||||
/// </summary>
|
||||
public Color color
|
||||
{
|
||||
get => m_Color;
|
||||
set
|
||||
{
|
||||
if (m_Color == value) return;
|
||||
|
||||
m_Color = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Noise texture.
|
||||
/// </summary>
|
||||
public Texture transitionTexture
|
||||
{
|
||||
get => m_TransitionTexture;
|
||||
set
|
||||
{
|
||||
if (m_TransitionTexture == value) return;
|
||||
|
||||
m_TransitionTexture = value;
|
||||
UpdateContext(context);
|
||||
SetVerticesDirty();
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
public EffectArea effectArea
|
||||
{
|
||||
get => EffectArea.RectTransform;
|
||||
set => m_EffectArea = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Keep aspect ratio.
|
||||
/// </summary>
|
||||
public bool keepAspectRatio
|
||||
{
|
||||
get => m_KeepAspectRatio;
|
||||
set
|
||||
{
|
||||
if (m_KeepAspectRatio == value) return;
|
||||
|
||||
m_KeepAspectRatio = value;
|
||||
UpdateContext(context);
|
||||
SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Color effect mode.
|
||||
/// </summary>
|
||||
public ColorMode colorMode
|
||||
{
|
||||
get => m_ColorMode;
|
||||
set
|
||||
{
|
||||
if (m_ColorMode == value) return;
|
||||
|
||||
m_ColorMode = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
public EffectPlayer effectPlayer => m_Player ??= new EffectPlayer();
|
||||
|
||||
/// <summary>
|
||||
/// Play effect.
|
||||
/// </summary>
|
||||
public void Play(bool reset = true)
|
||||
{
|
||||
effectPlayer.Attach(this);
|
||||
effectPlayer.Play(reset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop effect.
|
||||
/// </summary>
|
||||
public void Stop(bool reset = true)
|
||||
{
|
||||
effectPlayer.Attach(this);
|
||||
effectPlayer.Stop(reset);
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
LoadDefaultTransitionTextureIfNeeded();
|
||||
base.OnEnable();
|
||||
if (effectPlayer.play)
|
||||
{
|
||||
effectPlayer.Attach(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
effectPlayer.OnDisable();
|
||||
}
|
||||
|
||||
protected override void UpdateContext(UIEffectContext c)
|
||||
{
|
||||
c.transitionFilter = TransitionFilter.Dissolve;
|
||||
c.transitionRate = m_EffectFactor;
|
||||
c.transitionTex = m_TransitionTexture;
|
||||
c.transitionKeepAspectRatio = m_KeepAspectRatio;
|
||||
c.transitionReverse = m_Reverse;
|
||||
c.transitionWidth = m_Width / 2;
|
||||
c.transitionSoftness = m_Softness / 3;
|
||||
c.transitionColor = m_Color;
|
||||
c.transitionColorFilter = m_ColorMode.Convert();
|
||||
}
|
||||
|
||||
private void LoadDefaultTransitionTextureIfNeeded()
|
||||
{
|
||||
if (m_TransitionTexture) return;
|
||||
var preset = UIEffectProjectSettings.LoadRuntimePreset("Legacy-UIDissolve");
|
||||
if (!preset) return;
|
||||
|
||||
m_TransitionTexture = preset.transitionTexture;
|
||||
}
|
||||
|
||||
public override void SetRate(float rate, UIEffectTweener.CullingMask mask)
|
||||
{
|
||||
effectFactor = rate;
|
||||
}
|
||||
|
||||
public override bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
|
||||
{
|
||||
return effectFactor < 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce76b7a490bd74f34a2f2752641aea24
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "UIEffect",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:735c8f008d0ad4caa9cdc4306f1c3042"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 794bd518c76104678ac16e3d677c4e93
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,226 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
public class UIEffectV4 : UIEffectBase
|
||||
{
|
||||
[FormerlySerializedAs("m_ToneLevel")]
|
||||
[Tooltip("Effect factor between 0(no effect) and 1(complete effect).")]
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_EffectFactor = 1;
|
||||
|
||||
[Tooltip("Color effect factor between 0(no effect) and 1(complete effect).")]
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_ColorFactor = 1;
|
||||
|
||||
[FormerlySerializedAs("m_Blur")]
|
||||
[Tooltip("How far is the blurring from the graphic.")]
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_BlurFactor = 1;
|
||||
|
||||
[FormerlySerializedAs("m_ToneMode")]
|
||||
[Tooltip("Effect mode")]
|
||||
[SerializeField]
|
||||
private EffectMode m_EffectMode = EffectMode.None;
|
||||
|
||||
[Tooltip("Color effect mode")]
|
||||
[SerializeField]
|
||||
private ColorMode m_ColorMode = ColorMode.Multiply;
|
||||
|
||||
[Tooltip("Blur effect mode")]
|
||||
[SerializeField]
|
||||
private BlurMode m_BlurMode = BlurMode.None;
|
||||
|
||||
[Tooltip("Advanced blurring remove common artifacts in the blur effect for uGUI.")]
|
||||
[SerializeField]
|
||||
private bool m_AdvancedBlur = false;
|
||||
|
||||
[Tooltip("Dissolve edge color.")]
|
||||
[SerializeField]
|
||||
private Color m_Color = new Color(0.0f, 0.25f, 1.0f);
|
||||
|
||||
[SerializeField]
|
||||
private bool m_GetColorOnAwake = true;
|
||||
|
||||
/// <summary>
|
||||
/// Effect factor between 0(no effect) and 1(complete effect).
|
||||
/// </summary>
|
||||
public float effectFactor
|
||||
{
|
||||
get => m_EffectFactor;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_EffectFactor, value)) return;
|
||||
|
||||
m_EffectFactor = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Color effect factor between 0(no effect) and 1(complete effect).
|
||||
/// </summary>
|
||||
public float colorFactor
|
||||
{
|
||||
get => m_ColorFactor;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_ColorFactor, value)) return;
|
||||
|
||||
m_ColorFactor = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// How far is the blurring from the graphic.
|
||||
/// </summary>
|
||||
public float blurFactor
|
||||
{
|
||||
get => m_BlurFactor;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_BlurFactor, value)) return;
|
||||
|
||||
m_BlurFactor = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effect mode.
|
||||
/// </summary>
|
||||
public EffectMode effectMode
|
||||
{
|
||||
get => m_EffectMode;
|
||||
set
|
||||
{
|
||||
if (m_EffectMode == value) return;
|
||||
|
||||
m_EffectMode = value;
|
||||
UpdateContext(context);
|
||||
SetVerticesDirty();
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Color effect mode.
|
||||
/// </summary>
|
||||
public ColorMode colorMode
|
||||
{
|
||||
get => m_ColorMode;
|
||||
set
|
||||
{
|
||||
if (m_ColorMode == value) return;
|
||||
|
||||
m_ColorMode = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Blur effect mode(readonly).
|
||||
/// </summary>
|
||||
public BlurMode blurMode
|
||||
{
|
||||
get => m_BlurMode;
|
||||
set
|
||||
{
|
||||
if (m_BlurMode == value) return;
|
||||
m_BlurMode = value;
|
||||
|
||||
UpdateContext(context);
|
||||
SetVerticesDirty();
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advanced blurring remove common artifacts in the blur effect for uGUI.
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public bool advancedBlur { get => m_AdvancedBlur; set => m_AdvancedBlur = value; }
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
if (m_GetColorOnAwake && TryGetComponent<Graphic>(out var g))
|
||||
{
|
||||
m_GetColorOnAwake = false;
|
||||
m_Color = g.color;
|
||||
g.color = Color.white;
|
||||
}
|
||||
|
||||
base.Awake();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void OnValidate()
|
||||
{
|
||||
if (m_GetColorOnAwake && TryGetComponent<Graphic>(out var g))
|
||||
{
|
||||
m_GetColorOnAwake = false;
|
||||
m_Color = g.color;
|
||||
g.color = Color.white;
|
||||
}
|
||||
|
||||
base.OnValidate();
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void UpdateContext(UIEffectContext c)
|
||||
{
|
||||
(c.toneFilter, c.samplingFilter) = (m_EffectMode, m_BlurMode).Convert();
|
||||
if (context.samplingFilter == SamplingFilter.Pixelation)
|
||||
{
|
||||
c.toneIntensity = 0;
|
||||
c.samplingIntensity = m_EffectFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
c.toneIntensity = m_EffectFactor;
|
||||
c.samplingIntensity = m_BlurFactor;
|
||||
}
|
||||
|
||||
c.colorFilter = m_ColorMode.Convert();
|
||||
c.colorIntensity = m_ColorFactor;
|
||||
c.color = m_Color;
|
||||
}
|
||||
|
||||
public override void SetRate(float rate, UIEffectTweener.CullingMask mask)
|
||||
{
|
||||
if (effectMode != EffectMode.None && 0 < (mask & UIEffectTweener.CullingMask.Tone))
|
||||
{
|
||||
effectFactor = rate;
|
||||
}
|
||||
|
||||
if (colorMode != ColorMode.Multiply && 0 < (mask & UIEffectTweener.CullingMask.Color))
|
||||
{
|
||||
colorFactor = rate;
|
||||
}
|
||||
|
||||
if (blurMode != BlurMode.None && 0 < (mask & UIEffectTweener.CullingMask.Sampling))
|
||||
{
|
||||
blurFactor = rate;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8b2ed11d675446c5a49da1ea296d490
|
||||
timeCreated: 1485321967
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,143 @@
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// HSV Modifier.
|
||||
/// </summary>
|
||||
// [AddComponentMenu("UI/UIEffects/UIHsvModifier", 4)]
|
||||
public class UIHsvModifier : UIEffectBase
|
||||
{
|
||||
[Header("Target")]
|
||||
[Tooltip("Target color to affect hsv shift.")]
|
||||
[SerializeField]
|
||||
[ColorUsage(false)]
|
||||
private Color m_TargetColor = Color.red;
|
||||
|
||||
[Tooltip("Color range to affect hsv shift [0 ~ 1].")]
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_Range = 0.1f;
|
||||
|
||||
[Header("Adjustment")]
|
||||
[Tooltip("Hue shift [-0.5 ~ 0.5].")]
|
||||
[SerializeField]
|
||||
[Range(-0.5f, 0.5f)]
|
||||
private float m_Hue;
|
||||
|
||||
[Tooltip("Saturation shift [-0.5 ~ 0.5].")]
|
||||
[SerializeField]
|
||||
[Range(-0.5f, 0.5f)]
|
||||
private float m_Saturation;
|
||||
|
||||
[Tooltip("Value shift [-0.5 ~ 0.5].")]
|
||||
[SerializeField]
|
||||
[Range(-0.5f, 0.5f)]
|
||||
private float m_Value;
|
||||
|
||||
/// <summary>
|
||||
/// Target color to affect hsv shift.
|
||||
/// </summary>
|
||||
public Color targetColor
|
||||
{
|
||||
get => m_TargetColor;
|
||||
set
|
||||
{
|
||||
if (m_TargetColor == value) return;
|
||||
|
||||
m_TargetColor = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Color range to affect hsv shift [0 ~ 1].
|
||||
/// </summary>
|
||||
public float range
|
||||
{
|
||||
get => m_Range;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp01(value);
|
||||
if (Mathf.Approximately(m_Range, value)) return;
|
||||
|
||||
m_Range = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saturation shift [-0.5 ~ 0.5].
|
||||
/// </summary>
|
||||
public float saturation
|
||||
{
|
||||
get => m_Saturation;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, -0.5f, 0.5f);
|
||||
if (Mathf.Approximately(m_Saturation, value)) return;
|
||||
|
||||
m_Saturation = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value shift [-0.5 ~ 0.5].
|
||||
/// </summary>
|
||||
public float value
|
||||
{
|
||||
get => m_Value;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, -0.5f, 0.5f);
|
||||
if (Mathf.Approximately(m_Value, value)) return;
|
||||
|
||||
m_Value = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hue shift [-0.5 ~ 0.5].
|
||||
/// </summary>
|
||||
public float hue
|
||||
{
|
||||
get => m_Hue;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, -0.5f, 0.5f);
|
||||
if (Mathf.Approximately(m_Hue, value)) return;
|
||||
|
||||
m_Hue = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetRate(float rate, UIEffectTweener.CullingMask mask)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void UpdateContext(UIEffectContext c)
|
||||
{
|
||||
c.colorFilter = ColorFilter.HsvModifier;
|
||||
c.colorIntensity = 1;
|
||||
c.color = new Color(m_Hue, m_Saturation, m_Value, 1);
|
||||
c.targetMode = TargetMode.Hue;
|
||||
c.targetColor = m_TargetColor;
|
||||
c.targetRange = m_Range;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efe700dddcd8341ff8607ac2c827b4b5
|
||||
timeCreated: 1523859834
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,216 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
[ExecuteAlways]
|
||||
[DisallowMultipleComponent]
|
||||
public class UIShiny : UIEffectBase
|
||||
{
|
||||
[FormerlySerializedAs("m_Location")]
|
||||
[Range(0, 1)]
|
||||
[SerializeField]
|
||||
private float m_EffectFactor = 0.5f;
|
||||
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_Width = 0.125f;
|
||||
|
||||
[SerializeField]
|
||||
[Range(0, 360)]
|
||||
private float m_Rotation = 135;
|
||||
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_Softness = 1f;
|
||||
|
||||
[FormerlySerializedAs("m_Alpha")]
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_Brightness = 0.5f;
|
||||
|
||||
[FormerlySerializedAs("m_Highlight")]
|
||||
[SerializeField]
|
||||
[Range(0, 1)]
|
||||
private float m_Gloss = 1;
|
||||
|
||||
[SerializeField]
|
||||
protected EffectArea m_EffectArea;
|
||||
|
||||
[SerializeField]
|
||||
private EffectPlayer m_Player;
|
||||
|
||||
[SerializeField]
|
||||
private Texture m_TransitionTexture;
|
||||
|
||||
public float effectFactor
|
||||
{
|
||||
get => m_EffectFactor;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_EffectFactor, value)) return;
|
||||
|
||||
m_EffectFactor = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Width for shiny effect.
|
||||
/// </summary>
|
||||
public float width
|
||||
{
|
||||
get => m_Width;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_Width, value)) return;
|
||||
|
||||
m_Width = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Softness for shiny effect.
|
||||
/// </summary>
|
||||
public float softness
|
||||
{
|
||||
get => m_Softness;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_Softness, value)) return;
|
||||
|
||||
m_Softness = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Brightness for shiny effect.
|
||||
/// </summary>
|
||||
public float brightness
|
||||
{
|
||||
get => m_Brightness;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_Brightness, value)) return;
|
||||
|
||||
m_Brightness = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gloss factor for shiny effect.
|
||||
/// </summary>
|
||||
public float gloss
|
||||
{
|
||||
get => m_Gloss;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_Gloss, value)) return;
|
||||
|
||||
m_Gloss = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
public EffectArea effectArea
|
||||
{
|
||||
get => EffectArea.RectTransform;
|
||||
set => m_EffectArea = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rotation for shiny effect.
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public float rotation
|
||||
{
|
||||
get => m_Rotation;
|
||||
set
|
||||
{
|
||||
if (Mathf.Approximately(m_Rotation, value)) return;
|
||||
m_Rotation = value;
|
||||
UpdateContext(context);
|
||||
SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public EffectPlayer effectPlayer => m_Player ?? (m_Player = new EffectPlayer());
|
||||
|
||||
/// <summary>
|
||||
/// Play effect.
|
||||
/// </summary>
|
||||
public void Play(bool reset = true)
|
||||
{
|
||||
effectPlayer.Play(reset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop effect.
|
||||
/// </summary>
|
||||
public void Stop(bool reset = true)
|
||||
{
|
||||
effectPlayer.Stop(reset);
|
||||
}
|
||||
|
||||
protected override void UpdateContext(UIEffectContext c)
|
||||
{
|
||||
c.transitionFilter = TransitionFilter.Shiny;
|
||||
c.transitionRate = m_EffectFactor;
|
||||
c.transitionTex = m_TransitionTexture;
|
||||
c.transitionWidth = m_Width * 2;
|
||||
c.transitionRotation = m_Rotation;
|
||||
c.transitionSoftness = m_Softness / 2;
|
||||
c.transitionColorFilter = 0.5f < m_Gloss ? ColorFilter.MultiplyAdditive : ColorFilter.Additive;
|
||||
c.transitionColor = new Color(1, 1, 1, m_Brightness);
|
||||
}
|
||||
|
||||
public override void SetRate(float rate, UIEffectTweener.CullingMask mask)
|
||||
{
|
||||
effectFactor = rate;
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
LoadDefaultTransitionTextureIfNeeded();
|
||||
base.OnEnable();
|
||||
|
||||
if (effectPlayer.play)
|
||||
{
|
||||
effectPlayer.Attach(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
effectPlayer.OnDisable();
|
||||
}
|
||||
|
||||
public override bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private void LoadDefaultTransitionTextureIfNeeded()
|
||||
{
|
||||
if (m_TransitionTexture) return;
|
||||
var preset = UIEffectProjectSettings.LoadRuntimePreset("Legacy-UIShiny");
|
||||
if (!preset) return;
|
||||
m_TransitionTexture = preset.transitionTexture;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f19b7e2285c104f6ca47d583f3e5444f
|
||||
timeCreated: 1523859834
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,261 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Coffee.UIEffects
|
||||
{
|
||||
public class UITransitionEffect : UIEffectBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Effect mode.
|
||||
/// </summary>
|
||||
public enum EffectMode
|
||||
{
|
||||
None = 0,
|
||||
Fade = 1,
|
||||
Cutoff = 2,
|
||||
Dissolve = 3
|
||||
}
|
||||
|
||||
[Tooltip("Effect mode.")]
|
||||
[SerializeField]
|
||||
private EffectMode m_EffectMode = EffectMode.Cutoff;
|
||||
|
||||
[Tooltip("Effect factor between 0(hidden) and 1(shown).")]
|
||||
[SerializeField]
|
||||
private float m_EffectFactor = 0.5f;
|
||||
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("m_NoiseTexture")]
|
||||
private Texture m_TransitionTexture;
|
||||
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private EffectArea m_EffectArea = EffectArea.RectTransform;
|
||||
|
||||
[Header("Advanced Option")]
|
||||
[Tooltip("Keep effect aspect ratio.")]
|
||||
[SerializeField]
|
||||
private bool m_KeepAspectRatio;
|
||||
|
||||
[Tooltip("Dissolve edge width.")]
|
||||
[SerializeField]
|
||||
private float m_DissolveWidth = 0.5f;
|
||||
|
||||
[Tooltip("Dissolve edge softness.")]
|
||||
[SerializeField]
|
||||
private float m_DissolveSoftness = 0.5f;
|
||||
|
||||
[Tooltip("Dissolve edge color.")]
|
||||
[SerializeField]
|
||||
private Color m_DissolveColor = new Color(0.0f, 0.25f, 1.0f);
|
||||
|
||||
[Tooltip("Disable the graphic's raycast target on hidden.")]
|
||||
[SerializeField]
|
||||
private bool m_PassRayOnHidden;
|
||||
|
||||
[Header("Effect Player")]
|
||||
[SerializeField]
|
||||
private EffectPlayer m_Player;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Effect factor between 0(no effect) and 1(complete effect).
|
||||
/// </summary>
|
||||
public float effectFactor
|
||||
{
|
||||
get => m_EffectFactor;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_EffectFactor, value)) return;
|
||||
|
||||
m_EffectFactor = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transition texture.
|
||||
/// </summary>
|
||||
public Texture transitionTexture
|
||||
{
|
||||
get => m_TransitionTexture;
|
||||
set
|
||||
{
|
||||
if (m_TransitionTexture == value) return;
|
||||
|
||||
m_TransitionTexture = value;
|
||||
UpdateContext(context);
|
||||
SetVerticesDirty();
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effect mode.
|
||||
/// </summary>
|
||||
public EffectMode effectMode
|
||||
{
|
||||
get => m_EffectMode;
|
||||
set
|
||||
{
|
||||
if (m_EffectMode == value) return;
|
||||
|
||||
m_EffectMode = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Keep aspect ratio.
|
||||
/// </summary>
|
||||
public bool keepAspectRatio
|
||||
{
|
||||
get => m_KeepAspectRatio;
|
||||
set
|
||||
{
|
||||
if (m_KeepAspectRatio == value) return;
|
||||
|
||||
m_KeepAspectRatio = value;
|
||||
UpdateContext(context);
|
||||
SetVerticesDirty();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dissolve edge width.
|
||||
/// </summary>
|
||||
public float dissolveWidth
|
||||
{
|
||||
get => m_DissolveWidth;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_DissolveWidth, value)) return;
|
||||
|
||||
m_DissolveWidth = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dissolve edge softness.
|
||||
/// </summary>
|
||||
public float dissolveSoftness
|
||||
{
|
||||
get => m_DissolveSoftness;
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, 1);
|
||||
if (Mathf.Approximately(m_DissolveSoftness, value)) return;
|
||||
|
||||
m_DissolveSoftness = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dissolve edge color.
|
||||
/// </summary>
|
||||
public Color dissolveColor
|
||||
{
|
||||
get => m_DissolveColor;
|
||||
set
|
||||
{
|
||||
if (m_DissolveColor == value) return;
|
||||
|
||||
m_DissolveColor = value;
|
||||
UpdateContext(context);
|
||||
ApplyContextToMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
public EffectArea effectArea
|
||||
{
|
||||
get => EffectArea.RectTransform;
|
||||
set => m_EffectArea = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disable graphic's raycast target on hidden.
|
||||
/// </summary>
|
||||
public bool passRayOnHidden
|
||||
{
|
||||
get => m_PassRayOnHidden;
|
||||
set => m_PassRayOnHidden = value;
|
||||
}
|
||||
|
||||
public EffectPlayer effectPlayer => m_Player ??= new EffectPlayer();
|
||||
|
||||
/// <summary>
|
||||
/// Show transition.
|
||||
/// </summary>
|
||||
public void Show(bool reset = true)
|
||||
{
|
||||
effectPlayer.loop = false;
|
||||
effectPlayer.Attach(this);
|
||||
effectPlayer.PlayReverse(reset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hide transition.
|
||||
/// </summary>
|
||||
public void Hide(bool reset = true)
|
||||
{
|
||||
effectPlayer.loop = false;
|
||||
effectPlayer.Attach(this);
|
||||
effectPlayer.Play(reset);
|
||||
}
|
||||
|
||||
public override void SetRate(float rate, UIEffectTweener.CullingMask mask)
|
||||
{
|
||||
effectFactor = rate;
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
LoadDefaultTransitionTextureIfNeeded();
|
||||
base.OnEnable();
|
||||
if (effectPlayer.play)
|
||||
{
|
||||
effectPlayer.Attach(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
effectPlayer.OnDisable();
|
||||
}
|
||||
|
||||
public override bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera)
|
||||
{
|
||||
return !passRayOnHidden || effectFactor < 1;
|
||||
}
|
||||
|
||||
protected override void UpdateContext(UIEffectContext c)
|
||||
{
|
||||
c.transitionFilter = m_EffectMode.Convert();
|
||||
c.transitionRate = m_EffectFactor;
|
||||
c.transitionTex = m_TransitionTexture;
|
||||
c.transitionKeepAspectRatio = m_KeepAspectRatio;
|
||||
c.transitionWidth = m_DissolveWidth / 2;
|
||||
c.transitionSoftness = m_DissolveSoftness / 3;
|
||||
c.transitionColor = m_DissolveColor;
|
||||
c.transitionColorFilter = ColorFilter.MultiplyAdditive;
|
||||
}
|
||||
|
||||
private void LoadDefaultTransitionTextureIfNeeded()
|
||||
{
|
||||
if (m_TransitionTexture) return;
|
||||
var preset = UIEffectProjectSettings.LoadRuntimePreset("Legacy-UIDissolve");
|
||||
if (!preset) return;
|
||||
|
||||
m_TransitionTexture = preset.transitionTexture;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 922b805bc01c243e5853d9cbb544118c
|
||||
timeCreated: 1538827562
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55493e3100c77463f8810af953f868d1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8a8c2f70fdf546008a119ed228c3bee
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &7749463962637935726
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5764462257046744452}
|
||||
- component: {fileID: 1645081683573595507}
|
||||
m_Layer: 0
|
||||
m_Name: Legacy-UIDissolve
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &5764462257046744452
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7749463962637935726}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1645081683573595507
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7749463962637935726}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 938fce054c42f40a3969e27a88d9bdd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ToneFilter: 0
|
||||
m_ToneIntensity: 1
|
||||
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_ColorFilter: 0
|
||||
m_ColorIntensity: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_SamplingFilter: 0
|
||||
m_SamplingIntensity: 0.5
|
||||
m_TransitionFilter: 3
|
||||
m_TransitionRate: 0.5
|
||||
m_TransitionReverse: 0
|
||||
m_TransitionTex: {fileID: 2800000, guid: 4ec2a5e3826e94129b91638b3d8f1b72, type: 3}
|
||||
m_TransitionTexScale: {x: 1, y: 1}
|
||||
m_TransitionTexOffset: {x: 0, y: 0}
|
||||
m_TransitionRotation: 0
|
||||
m_TransitionKeepAspectRatio: 1
|
||||
m_TransitionWidth: 0.15
|
||||
m_TransitionSoftness: 0.4
|
||||
m_TransitionColorFilter: 6
|
||||
m_TransitionColor: {r: 0, g: 0.5, b: 1, a: 1}
|
||||
m_TargetMode: 0
|
||||
m_TargetColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_TargetRange: 1
|
||||
m_TargetSoftness: 0.5
|
||||
m_BlendType: 1
|
||||
m_SrcBlendMode: 1
|
||||
m_DstBlendMode: 10
|
||||
m_ShadowMode: 0
|
||||
m_ShadowDistance: {x: 1, y: -1}
|
||||
m_ShadowIteration: 1
|
||||
m_ShadowFade: 0.9
|
||||
m_ShadowEffectOnOrigin: 0
|
||||
m_ShadowMirrorScale: 0.5
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b09ad143990c4c8795c6e93760e132a
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &7749463962637935726
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5764462257046744452}
|
||||
- component: {fileID: 1645081683573595507}
|
||||
m_Layer: 0
|
||||
m_Name: Legacy-UIShiny
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &5764462257046744452
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7749463962637935726}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1645081683573595507
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7749463962637935726}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 938fce054c42f40a3969e27a88d9bdd8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ToneFilter: 0
|
||||
m_ToneIntensity: 1
|
||||
m_ToneParams: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_ColorFilter: 0
|
||||
m_ColorIntensity: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_SamplingFilter: 0
|
||||
m_SamplingIntensity: 0.5
|
||||
m_TransitionFilter: 4
|
||||
m_TransitionRate: 0.5
|
||||
m_TransitionReverse: 0
|
||||
m_TransitionTex: {fileID: 2800000, guid: 297e4244884ca46788412fdf92bbdb8b, type: 3}
|
||||
m_TransitionTexScale: {x: 1, y: 1}
|
||||
m_TransitionTexOffset: {x: 0, y: 0}
|
||||
m_TransitionRotation: 0
|
||||
m_TransitionKeepAspectRatio: 1
|
||||
m_TransitionWidth: 0.25
|
||||
m_TransitionSoftness: 0.5
|
||||
m_TransitionColorFilter: 6
|
||||
m_TransitionColor: {r: 0, g: 1, b: 1, a: 1}
|
||||
m_TargetMode: 0
|
||||
m_TargetColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_TargetRange: 1
|
||||
m_TargetSoftness: 0.5
|
||||
m_BlendType: 1
|
||||
m_SrcBlendMode: 1
|
||||
m_DstBlendMode: 10
|
||||
m_ShadowMode: 0
|
||||
m_ShadowDistance: {x: 1, y: -1}
|
||||
m_ShadowIteration: 1
|
||||
m_ShadowFade: 0.9
|
||||
m_ShadowEffectOnOrigin: 0
|
||||
m_ShadowMirrorScale: 0.5
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f70ff0f1e25b4388b9bcb38d619f7bf
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
+159
@@ -0,0 +1,159 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 297e4244884ca46788412fdf92bbdb8b
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 2
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 10
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
+100
@@ -0,0 +1,100 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ec2a5e3826e94129b91638b3d8f1b72
|
||||
timeCreated: 1524468976
|
||||
licenseType: Pro
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 2
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 10
|
||||
textureShape: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 256
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Standalone
|
||||
maxTextureSize: 256
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: iPhone
|
||||
maxTextureSize: 256
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: Android
|
||||
maxTextureSize: 256
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
- buildTarget: WebGL
|
||||
maxTextureSize: 256
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user