style: code format
parent
1b5588f418
commit
56dfb3c96e
|
|
@ -1,18 +1,15 @@
|
||||||
using System.Collections;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace Coffee.UIExtensions.Demos
|
namespace Coffee.UIExtensions.Demos
|
||||||
{
|
{
|
||||||
public class Unmask_Demo : MonoBehaviour
|
public class Unmask_Demo : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] Button target;
|
[SerializeField] Unmask unmask = null;
|
||||||
[SerializeField] Unmask unmask;
|
[SerializeField] Graphic transition = null;
|
||||||
[SerializeField] Graphic transition;
|
[SerializeField] Image transitionImage = null;
|
||||||
[SerializeField] Image transitionImage;
|
[SerializeField] Sprite unity_chan = null;
|
||||||
[SerializeField] Sprite unity_chan;
|
[SerializeField] Sprite unity_frame = null;
|
||||||
[SerializeField] Sprite unity_frame;
|
|
||||||
|
|
||||||
public void AutoFitToButton(bool flag)
|
public void AutoFitToButton(bool flag)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using System.Collections;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
using UnityEngine.Profiling;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.Rendering;
|
using UnityEngine.Rendering;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
|
@ -17,20 +16,23 @@ namespace Coffee.UIExtensions
|
||||||
//################################
|
//################################
|
||||||
// Constant or Static Members.
|
// Constant or Static Members.
|
||||||
//################################
|
//################################
|
||||||
static readonly Vector2 s_Center = new Vector2(0.5f, 0.5f);
|
private static readonly Vector2 s_Center = new Vector2(0.5f, 0.5f);
|
||||||
|
|
||||||
|
|
||||||
//################################
|
//################################
|
||||||
// Serialize Members.
|
// Serialize Members.
|
||||||
//################################
|
//################################
|
||||||
[Tooltip("Fit graphic's transform to target transform.")]
|
[Tooltip("Fit graphic's transform to target transform.")]
|
||||||
[SerializeField] RectTransform m_FitTarget;
|
[SerializeField] private RectTransform m_FitTarget;
|
||||||
|
|
||||||
[Tooltip("Fit graphic's transform to target transform on LateUpdate every frame.")]
|
[Tooltip("Fit graphic's transform to target transform on LateUpdate every frame.")]
|
||||||
[SerializeField] bool m_FitOnLateUpdate;
|
[SerializeField] private bool m_FitOnLateUpdate;
|
||||||
|
|
||||||
[Tooltip("Unmask affects only for children.")]
|
[Tooltip("Unmask affects only for children.")]
|
||||||
[SerializeField] bool m_OnlyForChildren = false;
|
[SerializeField] private bool m_OnlyForChildren = false;
|
||||||
|
|
||||||
[Tooltip("Show the graphic that is associated with the unmask render area.")]
|
[Tooltip("Show the graphic that is associated with the unmask render area.")]
|
||||||
[SerializeField] bool m_ShowUnmaskGraphic = false;
|
[SerializeField] private bool m_ShowUnmaskGraphic = false;
|
||||||
|
|
||||||
|
|
||||||
//################################
|
//################################
|
||||||
|
|
@ -39,7 +41,7 @@ namespace Coffee.UIExtensions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The graphic associated with the unmask.
|
/// The graphic associated with the unmask.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Graphic graphic{ get { return _graphic ?? (_graphic = GetComponent<Graphic>()); } }
|
public MaskableGraphic graphic { get { return _graphic ?? (_graphic = GetComponent<MaskableGraphic>()); } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fit graphic's transform to target transform.
|
/// Fit graphic's transform to target transform.
|
||||||
|
|
@ -146,14 +148,14 @@ namespace Coffee.UIExtensions
|
||||||
//################################
|
//################################
|
||||||
// Private Members.
|
// Private Members.
|
||||||
//################################
|
//################################
|
||||||
Material _unmaskMaterial;
|
private Material _unmaskMaterial;
|
||||||
Material _revertUnmaskMaterial;
|
private Material _revertUnmaskMaterial;
|
||||||
Graphic _graphic;
|
private MaskableGraphic _graphic;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function is called when the object becomes enabled and active.
|
/// This function is called when the object becomes enabled and active.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
if (m_FitTarget)
|
if (m_FitTarget)
|
||||||
{
|
{
|
||||||
|
|
@ -165,7 +167,7 @@ namespace Coffee.UIExtensions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function is called when the behaviour becomes disabled () or inactive.
|
/// This function is called when the behaviour becomes disabled () or inactive.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
StencilMaterial.Remove(_unmaskMaterial);
|
StencilMaterial.Remove(_unmaskMaterial);
|
||||||
StencilMaterial.Remove(_revertUnmaskMaterial);
|
StencilMaterial.Remove(_revertUnmaskMaterial);
|
||||||
|
|
@ -185,7 +187,7 @@ namespace Coffee.UIExtensions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// LateUpdate is called every frame, if the Behaviour is enabled.
|
/// LateUpdate is called every frame, if the Behaviour is enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void LateUpdate()
|
private void LateUpdate()
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
if (m_FitTarget && (m_FitOnLateUpdate || !Application.isPlaying))
|
if (m_FitTarget && (m_FitOnLateUpdate || !Application.isPlaying))
|
||||||
|
|
@ -201,7 +203,7 @@ namespace Coffee.UIExtensions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function is called when the script is loaded or a value is changed in the inspector (Called in the editor only).
|
/// This function is called when the script is loaded or a value is changed in the inspector (Called in the editor only).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void OnValidate()
|
private void OnValidate()
|
||||||
{
|
{
|
||||||
SetDirty();
|
SetDirty();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
using System.Collections;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Coffee.UIExtensions
|
namespace Coffee.UIExtensions
|
||||||
{
|
{
|
||||||
|
|
@ -17,7 +13,7 @@ namespace Coffee.UIExtensions
|
||||||
// Serialize Members.
|
// Serialize Members.
|
||||||
//################################
|
//################################
|
||||||
[Tooltip("Target unmask component. The ray passes through the unmasked rectangle.")]
|
[Tooltip("Target unmask component. The ray passes through the unmasked rectangle.")]
|
||||||
[SerializeField] Unmask m_TargetUnmask;
|
[SerializeField] private Unmask m_TargetUnmask;
|
||||||
|
|
||||||
|
|
||||||
//################################
|
//################################
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue