Compare commits

..

3 Commits

Author SHA1 Message Date
semantic-release-bot 332340e7bc 4.0.0-preview.10
# [4.0.0-preview.10](https://github.com/mob-sakai/UIEffect/compare/v4.0.0-preview.9...v4.0.0-preview.10) (2023-11-09)

### Bug Fixes

* ExecuteInEditMode to ExecuteAlways ([c750810](https://github.com/mob-sakai/UIEffect/commit/c75081095f580b12730b06f9a668a991bb5e8fe6))
2023-11-09 08:50:33 +00:00
semantic-release-bot b43e40508b 4.0.0-preview.9
# [4.0.0-preview.9](https://github.com/mob-sakai/UIEffect/compare/v4.0.0-preview.8...v4.0.0-preview.9) (2020-06-09)

### Features

* add a new property to access EffectPlayer at runtime ([d92efa9](https://github.com/mob-sakai/UIEffect/commit/d92efa98a1fc7b78d3421d9ee0b4bdaa74511bdc)), closes [#214](https://github.com/mob-sakai/UIEffect/issues/214) [#215](https://github.com/mob-sakai/UIEffect/issues/215)
2020-06-09 05:50:25 +00:00
semantic-release-bot 7371e889ad 4.0.0-preview.8
# [4.0.0-preview.8](https://github.com/mob-sakai/UIEffect/compare/v4.0.0-preview.7...v4.0.0-preview.8) (2020-06-04)

### change

* change namespace ([7f4190c](https://github.com/mob-sakai/UIEffect/commit/7f4190c8c6f294e90869767a96194ec5ac4ba57f))

### Features

* modify EffectPlayer at runtime ([8483ba6](https://github.com/mob-sakai/UIEffect/commit/8483ba63cb546ca032915c166c0333fa5fd7aa76)), closes [#214](https://github.com/mob-sakai/UIEffect/issues/214) [#215](https://github.com/mob-sakai/UIEffect/issues/215)

### BREAKING CHANGES

* If your code contained the UIEffect API, it would fail to compile. Please change the namespace from  to .
2020-06-04 08:22:42 +00:00
43 changed files with 215 additions and 301 deletions
+31
View File
@@ -1,3 +1,34 @@
# [4.0.0-preview.10](https://github.com/mob-sakai/UIEffect/compare/v4.0.0-preview.9...v4.0.0-preview.10) (2023-11-09)
### Bug Fixes
* ExecuteInEditMode to ExecuteAlways ([c750810](https://github.com/mob-sakai/UIEffect/commit/c75081095f580b12730b06f9a668a991bb5e8fe6))
# [4.0.0-preview.9](https://github.com/mob-sakai/UIEffect/compare/v4.0.0-preview.8...v4.0.0-preview.9) (2020-06-09)
### Features
* add a new property to access EffectPlayer at runtime ([d92efa9](https://github.com/mob-sakai/UIEffect/commit/d92efa98a1fc7b78d3421d9ee0b4bdaa74511bdc)), closes [#214](https://github.com/mob-sakai/UIEffect/issues/214) [#215](https://github.com/mob-sakai/UIEffect/issues/215)
# [4.0.0-preview.8](https://github.com/mob-sakai/UIEffect/compare/v4.0.0-preview.7...v4.0.0-preview.8) (2020-06-04)
### change
* change namespace ([7f4190c](https://github.com/mob-sakai/UIEffect/commit/7f4190c8c6f294e90869767a96194ec5ac4ba57f))
### Features
* modify EffectPlayer at runtime ([8483ba6](https://github.com/mob-sakai/UIEffect/commit/8483ba63cb546ca032915c166c0333fa5fd7aa76)), closes [#214](https://github.com/mob-sakai/UIEffect/issues/214) [#215](https://github.com/mob-sakai/UIEffect/issues/215)
### BREAKING CHANGES
* If your code contained the UIEffect API, it would fail to compile. Please change the namespace from `Coffee.UIExtensions` to `Coffee.UIEffects`.
# [4.0.0-preview.7](https://github.com/mob-sakai/UIEffect/compare/v4.0.0-preview.6...v4.0.0-preview.7) (2020-05-11)
+6 -11
View File
@@ -113,18 +113,13 @@ Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension) to insta
<br><br><br><br>
## How to play demo
#### For Unity 2019.1 or later
- For Unity 2019.1 or later
- Open `Package Manager` window and select `UI Effect` package in package list and click `Demo > Import in project` button
- For Unity 2018.4 or earlier
- Click `Assets/Samples/UIEffect/Import Demo` from menu
1. Open `Package Manager` window and select `UI Particle` package in package list
2. Click `Import in project` button
![](https://user-images.githubusercontent.com/12690315/79000480-a8bd4880-7b87-11ea-89c7-a17033a486ba.png)
3. The demo will be imported into `Assets/Samples/UI Effect/{version}/Demo`; open `UIEffect_Demo` scene and play it
#### For Unity 2018.4 or earlier
1. Select `Assets/Samples/UI Effect Demo` from menu
![Assets_と_Menubar](https://user-images.githubusercontent.com/12690315/79001101-dd7dcf80-7b88-11ea-9cf2-b44c6c5c9b17.png)
2. The demo will be imported into `Assets/Samples/UI Effect/{version}/Demo`; open `UIEffect_Demo` scene and play it
The assets will be imported into `Assets/Samples/UI Effect/{version}/Demo`.
Open `
+1 -1
View File
@@ -1,4 +1,4 @@
Shader "Hidden/UIDissolve"
Shader "Hidden/UI/Default (UIDissolve)"
{
Properties
{
+1 -1
View File
@@ -1,4 +1,4 @@
Shader "Hidden/UIEffect"
Shader "Hidden/UI/Default (UIEffect)"
{
Properties
{
+9 -9
View File
@@ -1,10 +1,10 @@
Shader "Hidden/UIHsvModifier"
Shader "Hidden/UI/Default (UIHsvModifier)"
{
Properties
{
[PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
@@ -21,19 +21,19 @@
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
@@ -76,4 +76,4 @@
ENDCG
}
}
}
}
+12 -12
View File
@@ -1,10 +1,10 @@
Shader "Hidden/UIShiny"
Shader "Hidden/UI/Default (UIShiny)"
{
Properties
{
[PerRendererData] _MainTex ("Main Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
@@ -21,19 +21,19 @@ Shader "Hidden/UIShiny"
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
@@ -53,9 +53,9 @@ Shader "Hidden/UIShiny"
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma multi_compile __ UNITY_UI_ALPHACLIP
#include "UnityCG.cginc"
#include "UnityUI.cginc"
@@ -69,11 +69,11 @@ Shader "Hidden/UIShiny"
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
color = ApplyShinyEffect(color, IN.eParam);
#ifdef UNITY_UI_ALPHACLIP
clip (color.a - 0.001);
#endif
return color;
}
ENDCG
+1 -1
View File
@@ -1,4 +1,4 @@
Shader "Hidden/UITransition"
Shader "Hidden/UI/Default (UITransition)"
{
Properties
{
+1 -1
View File
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
public class UIEffect_Demo : MonoBehaviour
{
+5 -4
View File
@@ -6,7 +6,7 @@ using System.Text;
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Abstract effect base for UI.
@@ -43,7 +43,6 @@ namespace Coffee.UIExtensions
foreach (var effect in syncEffects)
{
effect.SetMaterialDirty();
// BaseConnector.FindConnector(effect.graphic).SetMaterialDirty(effect.graphic);
}
}
@@ -129,12 +128,13 @@ namespace Coffee.UIExtensions
/// </summary>
protected override void OnEnable()
{
base.OnEnable();
if (paramTex != null)
{
paramTex.Register(this);
}
SetVerticesDirty();
SetMaterialDirty();
SetEffectParamsDirty();
@@ -150,7 +150,8 @@ namespace Coffee.UIExtensions
/// </summary>
protected override void OnDisable()
{
SetVerticesDirty();
base.OnDisable();
SetMaterialDirty();
if (paramTex != null)
+6 -15
View File
@@ -3,7 +3,7 @@ using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Base class for effects that modify the generated Mesh.
@@ -11,19 +11,19 @@ namespace Coffee.UIExtensions
/// </summary>
[RequireComponent(typeof(Graphic))]
[RequireComponent(typeof(RectTransform))]
[ExecuteInEditMode]
[ExecuteAlways]
public abstract class BaseMeshEffect : UIBehaviour, IMeshModifier
{
RectTransform _rectTransform;
Graphic _graphic;
BaseConnector _connector;
GraphicConnector _connector;
/// <summary>
/// The Graphic attached to this GameObject.
/// </summary>
protected BaseConnector connector
protected GraphicConnector connector
{
get { return _connector ?? (_connector = BaseConnector.FindConnector(graphic)); }
get { return _connector ?? (_connector = GraphicConnector.FindConnector(graphic)); }
}
/// <summary>
@@ -44,15 +44,6 @@ namespace Coffee.UIExtensions
internal readonly List<UISyncEffect> syncEffects = new List<UISyncEffect>(0);
/// <summary>
/// The material for rendering.
/// </summary>
// public virtual Material material
// {
// get { return connector.GetMaterial(graphic); }
// set { connector.SetMaterial(graphic, value); }
// }
/// <summary>
/// Call used to modify mesh. (legacy)
/// </summary>
@@ -146,7 +137,7 @@ namespace Coffee.UIExtensions
// _initialized = true;
// _graphic = _graphic ? _graphic : GetComponent<Graphic>();
//
// _connector = BaseConnector.FindConnector(_graphic);
// _connector = GraphicConnector.FindConnector(_graphic);
//
// // _canvasRenderer = _canvasRenderer ?? GetComponent<CanvasRenderer> ();
// _rectTransform = _rectTransform ? _rectTransform : GetComponent<RectTransform>();
+1 -1
View File
@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Effect player.
@@ -1,17 +1,18 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections.Generic;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
public class BaseConnector
public class GraphicConnector
{
private static readonly List<BaseConnector> s_Connectors = new List<BaseConnector>();
private static readonly Dictionary<Type, BaseConnector> s_ConnectorMap = new Dictionary<Type, BaseConnector>();
private static readonly BaseConnector s_EmptyConnector = new BaseConnector();
private static readonly List<GraphicConnector> s_Connectors = new List<GraphicConnector>();
private static readonly Dictionary<Type, GraphicConnector> s_ConnectorMap =
new Dictionary<Type, GraphicConnector>();
private static readonly GraphicConnector s_EmptyConnector = new GraphicConnector();
#if UNITY_EDITOR
[UnityEditor.InitializeOnLoadMethod]
@@ -19,21 +20,21 @@ namespace Coffee.UIExtensions
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void Init()
{
AddConnector(s_EmptyConnector);
AddConnector(new GraphicConnector());
}
protected static void AddConnector(BaseConnector connector)
protected static void AddConnector(GraphicConnector connector)
{
s_Connectors.Add(connector);
s_Connectors.Sort((x, y) => y.priority - x.priority);
}
public static BaseConnector FindConnector(Graphic graphic)
public static GraphicConnector FindConnector(Graphic graphic)
{
if (!graphic) return s_EmptyConnector;
var type = graphic.GetType();
BaseConnector connector = null;
GraphicConnector connector = null;
if (s_ConnectorMap.TryGetValue(type, out connector)) return connector;
foreach (var c in s_Connectors)
@@ -47,6 +48,22 @@ namespace Coffee.UIExtensions
return s_EmptyConnector;
}
/// <summary>
/// Connector priority.
/// </summary>
protected virtual int priority
{
get { return -1; }
}
/// <summary>
/// Extra channel.
/// </summary>
public virtual AdditionalCanvasShaderChannels extraChannel
{
get { return AdditionalCanvasShaderChannels.TexCoord1; }
}
/// <summary>
/// The connector is valid for the component.
/// </summary>
@@ -60,52 +77,7 @@ namespace Coffee.UIExtensions
/// </summary>
public virtual Shader FindShader(string shaderName)
{
return null;
}
/// <summary>
/// Priority.
/// </summary>
protected virtual int priority
{
get { return -1; }
}
/// <summary>
/// Extra channel.
/// </summary>
public virtual AdditionalCanvasShaderChannels extraChannel
{
get { return AdditionalCanvasShaderChannels.None; }
}
/// <summary>
/// Set material.
/// </summary>
public virtual void SetMaterial(Graphic graphic, Material material)
{
}
/// <summary>
/// Get material.
/// </summary>
public virtual Material GetMaterial(Graphic graphic)
{
return null;
}
/// <summary>
/// Mark the vertices as dirty.
/// </summary>
public virtual void SetVerticesDirty(Graphic graphic)
{
}
/// <summary>
/// Mark the material as dirty.
/// </summary>
public virtual void SetMaterialDirty(Graphic graphic)
{
return Shader.Find("Hidden/" + shaderName);
}
/// <summary>
@@ -123,17 +95,27 @@ namespace Coffee.UIExtensions
}
/// <summary>
/// Event that is called just before Canvas rendering happens.
/// This allows you to delay processing / updating of canvas based elements until just before they are rendered.
/// Mark the vertices as dirty.
/// </summary>
protected virtual void OnWillRenderCanvases()
public virtual void SetVerticesDirty(Graphic graphic)
{
if (graphic)
graphic.SetVerticesDirty();
}
/// <summary>
/// Mark the material as dirty.
/// </summary>
public virtual void SetMaterialDirty(Graphic graphic)
{
if (graphic)
graphic.SetMaterialDirty();
}
/// <summary>
/// Gets position factor for area.
/// </summary>
public void GetPositionFactor(EffectArea area, int index, Rect rect, Vector2 position, out float x, out float y)
public virtual void GetPositionFactor(EffectArea area, int index, Rect rect, Vector2 position, out float x, out float y)
{
if (area == EffectArea.Fit)
{
@@ -147,22 +129,23 @@ namespace Coffee.UIExtensions
}
}
/// <summary>
/// Normalize vertex position by local matrix.
/// </summary>
public void GetNormalizedFactor(EffectArea area, int index, Matrix2x3 matrix, Vector2 position,
out Vector2 normalizedPos)
{
normalizedPos = matrix * position;
}
public virtual bool IsText(Graphic graphic)
{
return false;
return graphic && graphic is Text;
}
public virtual void SetExtraChannel(ref UIVertex vertex, Vector2 value)
{
vertex.uv1 = value;
}
/// <summary>
/// Normalize vertex position by local matrix.
/// </summary>
public virtual void GetNormalizedFactor(EffectArea area, int index, Matrix2x3 matrix, Vector2 position,
out Vector2 normalizedPos)
{
normalizedPos = matrix * position;
}
}
}
+3 -2
View File
@@ -5,7 +5,7 @@ using UnityEngine;
using System.Text;
using UnityEngine.UI;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
public class MaterialCache
{
@@ -40,7 +40,8 @@ namespace Coffee.UIExtensions
}
#endif
public static Material Register(Material baseMaterial, Hash128 hash, System.Action<Material, Graphic> onModifyMaterial, Graphic graphic)
public static Material Register(Material baseMaterial, Hash128 hash,
System.Action<Material, Graphic> onModifyMaterial, Graphic graphic)
{
if (!hash.isValid) return null;
+1 -1
View File
@@ -1,6 +1,6 @@
using UnityEngine;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Matrix2x3.
+2 -2
View File
@@ -4,7 +4,7 @@ using UnityEngine;
using UnityEngine.Rendering;
using System;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
public interface IParameterTexture
{
@@ -24,7 +24,7 @@ namespace Coffee.UIExtensions
//################################
/// <summary>
/// Initializes a new instance of the <see cref="Coffee.UIExtensions.ParameterTexture"/> class.
/// Initializes a new instance of the <see cref="Coffee.UIEffects.ParameterTexture"/> class.
/// </summary>
/// <param name="channels">Channels.</param>
/// <param name="instanceLimit">Instance limit.</param>
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 73be53ea7d09c45bc83e7b957a5b99b5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-11
View File
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1fa123391c81f40ffbbe761447b7913c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-70
View File
@@ -1,70 +0,0 @@
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions
{
public class GraphicConnector : BaseConnector
{
#if UNITY_EDITOR
[UnityEditor.InitializeOnLoadMethod]
#endif
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void Init()
{
AddConnector(new GraphicConnector());
}
protected override int priority
{
get { return 0; }
}
public override Material GetMaterial(Graphic graphic)
{
return graphic ? graphic.material : null;
}
public override void SetMaterial(Graphic graphic, Material material)
{
if (graphic)
graphic.material = material;
}
public override AdditionalCanvasShaderChannels extraChannel
{
get { return AdditionalCanvasShaderChannels.TexCoord1; }
}
public override Shader FindShader(string shaderName)
{
return Shader.Find("Hidden/" + shaderName);
}
protected override bool IsValid(Graphic graphic)
{
return graphic;
}
public override void SetVerticesDirty(Graphic graphic)
{
if (graphic)
graphic.SetVerticesDirty();
}
public override void SetMaterialDirty(Graphic graphic)
{
if (graphic)
graphic.SetMaterialDirty();
}
public override bool IsText(Graphic graphic)
{
return graphic && graphic is Text;
}
public override void SetExtraChannel(ref UIVertex vertex, Vector2 value)
{
vertex.uv1 = value;
}
}
}
+6 -5
View File
@@ -4,14 +4,15 @@ using System.Linq;
using System.Text.RegularExpressions;
using UnityEditor;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
public static class ImportSampleMenu_UIEffect
public static class ImportSampleMenu
{
[MenuItem("Assets/Samples/Import UIEffect Sample")]
private static void ImportSample()
private const string jsonGuid = "546af75b6221c4768be79d67c9cea1fb";
[MenuItem("Assets/Samples/UIEffect/Import Demo")]
private static void ImportDemo()
{
const string jsonGuid = "546af75b6221c4768be79d67c9cea1fb";
ImportSample(jsonGuid, "Demo");
}
+1 -1
View File
@@ -2,7 +2,7 @@
using UnityEditor;
using UnityEngine;
namespace Coffee.UIExtensions.Editors
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// Changes in this scope cause the graphic's material to be dirty.
+1 -1
View File
@@ -5,7 +5,7 @@ using System.Linq;
using System.Collections.Generic;
using UnityEngine.UI;
namespace Coffee.UIExtensions.Editors
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// UIEffect editor.
+1 -1
View File
@@ -4,7 +4,7 @@ using UnityEngine;
using System.Linq;
using System;
namespace Coffee.UIExtensions.Editors
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// UIEffect editor.
+1 -1
View File
@@ -2,7 +2,7 @@
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions.Editors
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// UIEffect editor.
+2 -2
View File
@@ -3,7 +3,7 @@ using UnityEditorInternal;
using UnityEngine;
using System.Linq;
namespace Coffee.UIExtensions.Editors
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// UIEffect editor.
@@ -50,4 +50,4 @@ namespace Coffee.UIExtensions.Editors
serializedObject.ApplyModifiedProperties();
}
}
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
using UnityEditorInternal;
using UnityEngine;
namespace Coffee.UIExtensions.Editors
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// UIShadow editor.
+2 -2
View File
@@ -3,7 +3,7 @@ using UnityEditorInternal;
using UnityEngine;
using System.Linq;
namespace Coffee.UIExtensions.Editors
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// UIEffect editor.
@@ -99,4 +99,4 @@ namespace Coffee.UIExtensions.Editors
serializedObject.ApplyModifiedProperties();
}
}
}
}
+2 -2
View File
@@ -3,7 +3,7 @@ using UnityEditorInternal;
using UnityEngine;
using System.Linq;
namespace Coffee.UIExtensions.Editors
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// UIEffect editor.
@@ -112,4 +112,4 @@ namespace Coffee.UIExtensions.Editors
serializedObject.ApplyModifiedProperties();
}
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Blur effect mode.
+1 -1
View File
@@ -1,4 +1,4 @@
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Color effect mode.
+1 -1
View File
@@ -1,7 +1,7 @@
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Area for effect.
+1 -1
View File
@@ -1,4 +1,4 @@
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Effect mode.
+1 -1
View File
@@ -1,4 +1,4 @@
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Shadow effect style.
+12 -12
View File
@@ -7,7 +7,7 @@ using System.Text;
using System.Linq;
using System.IO;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Dissolve effect for uGUI.
@@ -196,6 +196,11 @@ namespace Coffee.UIExtensions
get { return s_ParamTex; }
}
public EffectPlayer effectPlayer
{
get { return m_Player ?? (m_Player = new EffectPlayer()); }
}
public override Hash128 GetMaterialHash(Material material)
{
if (!isActiveAndEnabled || !material || !material.shader)
@@ -213,8 +218,8 @@ namespace Coffee.UIExtensions
public override void ModifyMaterial(Material newMaterial, Graphic graphic)
{
var connector = BaseConnector.FindConnector(graphic);
newMaterial.shader = connector.FindShader("UIDissolve");
var connector = GraphicConnector.FindConnector(graphic);
newMaterial.shader = Shader.Find(string.Format("Hidden/{0} (UIDissolve)", newMaterial.shader.name));
SetShaderVariants(newMaterial, m_ColorMode);
newMaterial.SetTexture(k_TransitionTexId, transitionTexture);
@@ -288,7 +293,7 @@ namespace Coffee.UIExtensions
/// </summary>
public void Play(bool reset = true)
{
_player.Play(reset);
effectPlayer.Play(reset);
}
/// <summary>
@@ -296,24 +301,19 @@ namespace Coffee.UIExtensions
/// </summary>
public void Stop(bool reset = true)
{
_player.Stop(reset);
effectPlayer.Stop(reset);
}
protected override void OnEnable()
{
base.OnEnable();
_player.OnEnable((f) => effectFactor = m_Reverse ? 1f - f : f);
effectPlayer.OnEnable((f) => effectFactor = m_Reverse ? 1f - f : f);
}
protected override void OnDisable()
{
base.OnDisable();
_player.OnDisable();
}
EffectPlayer _player
{
get { return m_Player ?? (m_Player = new EffectPlayer()); }
effectPlayer.OnDisable();
}
}
}
+4 -4
View File
@@ -10,12 +10,12 @@ using UnityEditor;
#endif
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// UIEffect.
/// </summary>
[ExecuteInEditMode]
[ExecuteAlways]
[RequireComponent(typeof(Graphic))]
[DisallowMultipleComponent]
[AddComponentMenu("UI/UIEffects/UIEffect", 1)]
@@ -192,9 +192,9 @@ namespace Coffee.UIExtensions
public override void ModifyMaterial(Material newMaterial, Graphic graphic)
{
var connector = BaseConnector.FindConnector(graphic);
var connector = GraphicConnector.FindConnector(graphic);
newMaterial.shader = connector.FindShader("UIEffect");
newMaterial.shader = Shader.Find(string.Format("Hidden/{0} (UIEffect)", newMaterial.shader.name));
SetShaderVariants(newMaterial, m_EffectMode, m_ColorMode, m_BlurMode,
m_AdvancedBlur ? BlurEx.Ex : BlurEx.None);
+3 -3
View File
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
[DisallowMultipleComponent]
[AddComponentMenu("UI/UIEffects/UIFlip", 102)]
@@ -16,7 +16,7 @@ namespace Coffee.UIExtensions
private bool m_Veritical = false;
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Coffee.UIExtensions.UIFlip"/> should be flipped horizontally.
/// Gets or sets a value indicating whether this <see cref="Coffee.UIEffects.UIFlip"/> should be flipped horizontally.
/// </summary>
/// <value><c>true</c> if be flipped horizontally; otherwise, <c>false</c>.</value>
public bool horizontal
@@ -31,7 +31,7 @@ namespace Coffee.UIExtensions
}
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Coffee.UIExtensions.UIFlip"/> should be flipped vertically.
/// Gets or sets a value indicating whether this <see cref="Coffee.UIEffects.UIFlip"/> should be flipped vertically.
/// </summary>
/// <value><c>true</c> if be flipped horizontally; otherwise, <c>false</c>.</value>
public bool vertical
+1 -1
View File
@@ -1,7 +1,7 @@
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// UIGradient.
+3 -3
View File
@@ -4,7 +4,7 @@ using UnityEngine.Serialization;
using UnityEngine.UI;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// HSV Modifier.
@@ -127,9 +127,9 @@ namespace Coffee.UIExtensions
public override void ModifyMaterial(Material newMaterial, Graphic graphic)
{
var connector = BaseConnector.FindConnector(graphic);
var connector = GraphicConnector.FindConnector(graphic);
newMaterial.shader = connector.FindShader("UIHsvModifier");
newMaterial.shader = Shader.Find(string.Format("Hidden/{0} (UIHsvModifier)", newMaterial.shader.name));
paramTex.RegisterMaterial(newMaterial);
}
+1 -1
View File
@@ -10,7 +10,7 @@ using UnityEditor;
#endif
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// UIEffect.
+12 -12
View File
@@ -5,7 +5,7 @@ using UnityEngine.Serialization;
using UnityEngine.UI;
using System.Collections;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// UIEffect.
@@ -153,13 +153,18 @@ namespace Coffee.UIExtensions
get { return s_ParamTex; }
}
public EffectPlayer effectPlayer
{
get { return m_Player ?? (m_Player = new EffectPlayer()); }
}
/// <summary>
/// This function is called when the object becomes enabled and active.
/// </summary>
protected override void OnEnable()
{
base.OnEnable();
_player.OnEnable(f => effectFactor = f);
effectPlayer.OnEnable(f => effectFactor = f);
}
/// <summary>
@@ -168,7 +173,7 @@ namespace Coffee.UIExtensions
protected override void OnDisable()
{
base.OnDisable();
_player.OnDisable();
effectPlayer.OnDisable();
}
@@ -187,9 +192,9 @@ namespace Coffee.UIExtensions
public override void ModifyMaterial(Material newMaterial, Graphic graphic)
{
var connector = BaseConnector.FindConnector(graphic);
var connector = GraphicConnector.FindConnector(graphic);
newMaterial.shader = connector.FindShader("UIShiny");
newMaterial.shader = Shader.Find(string.Format("Hidden/{0} (UIShiny)", newMaterial.shader.name));
paramTex.RegisterMaterial(newMaterial);
}
@@ -233,7 +238,7 @@ namespace Coffee.UIExtensions
/// </summary>
public void Play(bool reset = true)
{
_player.Play(reset);
effectPlayer.Play(reset);
}
/// <summary>
@@ -241,7 +246,7 @@ namespace Coffee.UIExtensions
/// </summary>
public void Stop(bool reset = true)
{
_player.Stop(reset);
effectPlayer.Stop(reset);
}
protected override void SetEffectParamsDirty()
@@ -269,10 +274,5 @@ namespace Coffee.UIExtensions
|| _lastEffectArea != m_EffectArea)
SetVerticesDirty();
}
EffectPlayer _player
{
get { return m_Player ?? (m_Player = new EffectPlayer()); }
}
}
}
+2 -2
View File
@@ -4,12 +4,12 @@ using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Dissolve effect for uGUI.
/// </summary>
[ExecuteInEditMode]
[ExecuteAlways]
public class UISyncEffect : BaseMaterialEffect
{
[Tooltip("The target effect to synchronize.")] [SerializeField]
+15 -15
View File
@@ -3,7 +3,7 @@ using UnityEngine.UI;
using UnityEngine.Serialization;
using System;
namespace Coffee.UIExtensions
namespace Coffee.UIEffects
{
/// <summary>
/// Transition effect.
@@ -192,13 +192,18 @@ namespace Coffee.UIExtensions
set { m_PassRayOnHidden = value; }
}
public EffectPlayer effectPlayer
{
get { return m_Player ?? (m_Player = new EffectPlayer()); }
}
/// <summary>
/// Show transition.
/// </summary>
public void Show(bool reset = true)
{
_player.loop = false;
_player.Play(reset, f => effectFactor = f);
effectPlayer.loop = false;
effectPlayer.Play(reset, f => effectFactor = f);
}
/// <summary>
@@ -206,8 +211,8 @@ namespace Coffee.UIExtensions
/// </summary>
public void Hide(bool reset = true)
{
_player.loop = false;
_player.Play(reset, f => effectFactor = 1 - f);
effectPlayer.loop = false;
effectPlayer.Play(reset, f => effectFactor = 1 - f);
}
@@ -228,8 +233,8 @@ namespace Coffee.UIExtensions
public override void ModifyMaterial(Material newMaterial, Graphic graphic)
{
var connector = BaseConnector.FindConnector(graphic);
newMaterial.shader = connector.FindShader("UITransition");
var connector = GraphicConnector.FindConnector(graphic);
newMaterial.shader = Shader.Find(string.Format("Hidden/{0} (UITransition)", newMaterial.shader.name));
SetShaderVariants(newMaterial, m_EffectMode);
newMaterial.SetTexture(k_TransitionTexId, transitionTexture);
@@ -277,8 +282,8 @@ namespace Coffee.UIExtensions
protected override void OnEnable()
{
base.OnEnable();
_player.OnEnable(null);
_player.loop = false;
effectPlayer.OnEnable(null);
effectPlayer.loop = false;
}
/// <summary>
@@ -287,7 +292,7 @@ namespace Coffee.UIExtensions
protected override void OnDisable()
{
base.OnDisable();
_player.OnDisable();
effectPlayer.OnDisable();
}
protected override void SetEffectParamsDirty()
@@ -323,10 +328,5 @@ namespace Coffee.UIExtensions
if (_lastKeepAspectRatio != m_KeepAspectRatio)
SetVerticesDirty();
}
EffectPlayer _player
{
get { return m_Player ?? (m_Player = new EffectPlayer()); }
}
}
}
+3 -3
View File
@@ -1,8 +1,8 @@
{
"name": "com.coffee.ui-effect",
"displayName": "UIEffect",
"description": "UIEffect provides visual effect components for Unity UI.\nLet's decorate your UI with effects!",
"version": "4.0.0-preview.7",
"displayName": "UI Effect",
"description": "UI Effect provides visual effect components for Unity UI.\nLet's decorate your UI with effects!",
"version": "4.0.0-preview.10",
"unity": "2017.1",
"license": "MIT",
"repository": {