NodeScript+ 导入了个 UI Extend
Signed-off-by: TRADER_FOER <lhf190@outlook.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/// Credit 00christian00
|
||||
/// Sourced from - http://forum.unity3d.com/threads/any-way-to-show-part-of-an-image-without-using-mask.360085/#post-2332030
|
||||
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[AddComponentMenu("UI/Effects/Extensions/UIAdditiveEffect")]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class UIAdditiveEffect : MonoBehaviour
|
||||
{
|
||||
MaskableGraphic mGraphic;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
|
||||
public void SetMaterial()
|
||||
{
|
||||
mGraphic = this.GetComponent<MaskableGraphic>();
|
||||
if (mGraphic != null)
|
||||
{
|
||||
if (mGraphic.material == null || mGraphic.material.name == "Default UI Material")
|
||||
{
|
||||
//Applying default material with UI Image Crop shader
|
||||
mGraphic.material = new Material(ShaderLibrary.GetShaderInstance("UI Extensions/UIAdditive"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Please attach component to a Graphical UI component");
|
||||
}
|
||||
}
|
||||
public void OnValidate()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a29c8587a101744ea9e6198d89cb2df
|
||||
timeCreated: 1464643709
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,70 @@
|
||||
/// Credit 00christian00
|
||||
/// Sourced from - http://forum.unity3d.com/threads/any-way-to-show-part-of-an-image-without-using-mask.360085/#post-2332030
|
||||
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[AddComponentMenu("UI/Effects/Extensions/UIImageCrop")]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class UIImageCrop : MonoBehaviour
|
||||
{
|
||||
MaskableGraphic mGraphic;
|
||||
Material mat;
|
||||
int XCropProperty, YCropProperty;
|
||||
public float XCrop = 0f;
|
||||
public float YCrop = 0f;
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
|
||||
public void SetMaterial()
|
||||
{
|
||||
mGraphic = this.GetComponent<MaskableGraphic>();
|
||||
XCropProperty = Shader.PropertyToID("_XCrop");
|
||||
YCropProperty = Shader.PropertyToID("_YCrop");
|
||||
if (mGraphic != null)
|
||||
{
|
||||
if (mGraphic.material == null || mGraphic.material.name == "Default UI Material")
|
||||
{
|
||||
//Applying default material with UI Image Crop shader
|
||||
mGraphic.material = new Material(ShaderLibrary.GetShaderInstance("UI Extensions/UI Image Crop"));
|
||||
}
|
||||
mat = mGraphic.material;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Please attach component to a Graphical UI component");
|
||||
}
|
||||
}
|
||||
public void OnValidate()
|
||||
{
|
||||
SetMaterial();
|
||||
SetXCrop(XCrop);
|
||||
SetYCrop(YCrop);
|
||||
}
|
||||
/// <summary>
|
||||
/// Set the x crop factor, with x being a normalized value 0-1f.
|
||||
/// </summary>
|
||||
/// <param name="xcrop"></param>
|
||||
public void SetXCrop(float xcrop)
|
||||
{
|
||||
XCrop = Mathf.Clamp01(xcrop);
|
||||
mat.SetFloat(XCropProperty, XCrop);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the y crop factor, with y being a normalized value 0-1f.
|
||||
/// </summary>
|
||||
/// <param name="ycrop"></param>
|
||||
public void SetYCrop(float ycrop)
|
||||
{
|
||||
YCrop = Mathf.Clamp01(ycrop);
|
||||
mat.SetFloat(YCropProperty, YCrop);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 022c3983095dce44c9504739a8ed7324
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,41 @@
|
||||
/// Credit 00christian00
|
||||
/// Sourced from - http://forum.unity3d.com/threads/any-way-to-show-part-of-an-image-without-using-mask.360085/#post-2332030
|
||||
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[AddComponentMenu("UI/Effects/Extensions/UILinearDodgeEffect")]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class UILinearDodgeEffect : MonoBehaviour
|
||||
{
|
||||
MaskableGraphic mGraphic;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
|
||||
public void SetMaterial()
|
||||
{
|
||||
mGraphic = this.GetComponent<MaskableGraphic>();
|
||||
if (mGraphic != null)
|
||||
{
|
||||
if (mGraphic.material == null || mGraphic.material.name == "Default UI Material")
|
||||
{
|
||||
//Applying default material with UI Image Crop shader
|
||||
mGraphic.material = new Material(ShaderLibrary.GetShaderInstance("UI Extensions/UILinearDodge"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Please attach component to a Graphical UI component");
|
||||
}
|
||||
}
|
||||
public void OnValidate()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4fbdc2185cba1c42ad07e43eea19561
|
||||
timeCreated: 1464643896
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
/// Credit 00christian00
|
||||
/// Sourced from - http://forum.unity3d.com/threads/any-way-to-show-part-of-an-image-without-using-mask.360085/#post-2332030
|
||||
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[AddComponentMenu("UI/Effects/Extensions/UIMultiplyEffect")]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class UIMultiplyEffect : MonoBehaviour
|
||||
{
|
||||
MaskableGraphic mGraphic;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
|
||||
public void SetMaterial()
|
||||
{
|
||||
mGraphic = this.GetComponent<MaskableGraphic>();
|
||||
if (mGraphic != null)
|
||||
{
|
||||
if (mGraphic.material == null || mGraphic.material.name == "Default UI Material")
|
||||
{
|
||||
//Applying default material with UI Image Crop shader
|
||||
mGraphic.material = new Material(ShaderLibrary.GetShaderInstance("UI Extensions/UIMultiply"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Please attach component to a Graphical UI component");
|
||||
}
|
||||
}
|
||||
public void OnValidate()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a1216dfb98544e44afb7fb3abc093f2
|
||||
timeCreated: 1464643921
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
/// Credit 00christian00
|
||||
/// Sourced from - http://forum.unity3d.com/threads/any-way-to-show-part-of-an-image-without-using-mask.360085/#post-2332030
|
||||
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[AddComponentMenu("UI/Effects/Extensions/UIScreenEffect")]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class UIScreenEffect : MonoBehaviour
|
||||
{
|
||||
MaskableGraphic mGraphic;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
|
||||
public void SetMaterial()
|
||||
{
|
||||
mGraphic = this.GetComponent<MaskableGraphic>();
|
||||
if (mGraphic != null)
|
||||
{
|
||||
if (mGraphic.material == null || mGraphic.material.name == "Default UI Material")
|
||||
{
|
||||
//Applying default material with UI Image Crop shader
|
||||
mGraphic.material = new Material(ShaderLibrary.GetShaderInstance("UI Extensions/UIScreen"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Please attach component to a Graphical UI component");
|
||||
}
|
||||
}
|
||||
public void OnValidate()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07afba72913387d488019cbb35ec1965
|
||||
timeCreated: 1464643319
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
/// Credit 00christian00
|
||||
/// Sourced from - http://forum.unity3d.com/threads/any-way-to-show-part-of-an-image-without-using-mask.360085/#post-2332030
|
||||
|
||||
|
||||
namespace UnityEngine.UI.Extensions
|
||||
{
|
||||
[AddComponentMenu("UI/Effects/Extensions/UISoftAdditiveEffect")]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
public class UISoftAdditiveEffect : MonoBehaviour
|
||||
{
|
||||
MaskableGraphic mGraphic;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
|
||||
public void SetMaterial()
|
||||
{
|
||||
mGraphic = this.GetComponent<MaskableGraphic>();
|
||||
if (mGraphic != null)
|
||||
{
|
||||
if (mGraphic.material == null || mGraphic.material.name == "Default UI Material")
|
||||
{
|
||||
//Applying default material with UI Image Crop shader
|
||||
mGraphic.material = new Material(ShaderLibrary.GetShaderInstance("UI Extensions/UISoftAdditive"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Please attach component to a Graphical UI component");
|
||||
}
|
||||
}
|
||||
public void OnValidate()
|
||||
{
|
||||
SetMaterial();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 692867a1eddc7df419ec15b05b4084ec
|
||||
timeCreated: 1464643947
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user