asset integration 50%
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class CanvasGroupUtils : MonoBehaviour
|
||||
{
|
||||
public UnityEngine.UI.Graphic[] graphics;
|
||||
public bool useOverrideColor = false;
|
||||
public Color overrideColor = Color.white;
|
||||
|
||||
|
||||
void OnValidate()
|
||||
{
|
||||
RefreshColor();
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
RefreshColor();
|
||||
}
|
||||
|
||||
|
||||
void RefreshColor(){
|
||||
if(useOverrideColor)
|
||||
{
|
||||
foreach(var graphic in graphics)
|
||||
{
|
||||
graphic.color = new Color(overrideColor.r, overrideColor.g, overrideColor.b, overrideColor.a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6e9b80351cd150478194c9959e87012
|
||||
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
using UnityEngine.UI;
|
||||
[RequireComponent(typeof(Image))]
|
||||
public class ImageBlinker : MonoBehaviour
|
||||
{
|
||||
public float duration = 0.5f;
|
||||
public Ease ease = Ease.InOutSine;
|
||||
public float from = 0f;
|
||||
public float to = 1f;
|
||||
public int loops = -1;
|
||||
public LoopType loopType = LoopType.Yoyo;
|
||||
|
||||
void Start()
|
||||
{
|
||||
var image = GetComponent<Image>();
|
||||
var c = image.color;
|
||||
c.a = from;
|
||||
image.color = c;
|
||||
image.DOFade(to, duration).SetEase(ease).SetLoops(loops, loopType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee65e1f8cf52cc24b989d032d572c1fa
|
||||
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
using UnityEngine.EventSystems;
|
||||
[RequireComponent(typeof(EventTrigger))]
|
||||
public class ScaleOnHover : MonoBehaviour
|
||||
{
|
||||
public float scaleFactor = 1.1f;
|
||||
public float duration = 0.1f;
|
||||
public Ease ease = Ease.OutBack;
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
EventTrigger eventTrigger = GetComponent<EventTrigger>();
|
||||
EventTrigger.Entry entry = new EventTrigger.Entry();
|
||||
entry.eventID = EventTriggerType.PointerEnter;
|
||||
entry.callback.AddListener((data) => { OnPointerEnter((PointerEventData)data); });
|
||||
eventTrigger.triggers.Add(entry);
|
||||
entry = new EventTrigger.Entry();
|
||||
entry.eventID = EventTriggerType.PointerExit;
|
||||
entry.callback.AddListener((data) => { OnPointerExit((PointerEventData)data); });
|
||||
eventTrigger.triggers.Add(entry);
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
transform.DOScale(scaleFactor, duration).SetEase(ease);
|
||||
}
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
transform.DOKill();
|
||||
transform.DOScale(1f, duration).SetEase(ease);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e4c65221cd965e45853c892a9facd82
|
||||
Reference in New Issue
Block a user