//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Thursday, March 28, 2019
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using DG.Tweening;
|
|
namespace vnxbqy.UI
|
{
|
|
public class MainWinRightBottomGrid : MonoBehaviour
|
{
|
[SerializeField] int m_Index;
|
public int index { get { return m_Index; } }
|
|
[SerializeField] int m_FunctionId;
|
[SerializeField] RectTransform m_Content;
|
[SerializeField] CanvasGroup m_CanvasGroup;
|
|
public RectTransform rectTransform { get { return this.transform as RectTransform; } }
|
|
float targetX = 0f;
|
float targetAlpha = 0f;
|
|
public void Switch(bool active, float offset, float delay)
|
{
|
targetX = active ? 0 : (120f + SafeAreaUI.SafeWidth + offset);
|
targetAlpha = active ? 1f : 0f;
|
|
if (active)
|
{
|
m_Content.DOLocalMoveX(targetX, 0.3f).SetDelay(delay).SetEase(Ease.OutSine);
|
}
|
else
|
{
|
m_Content.DOLocalMoveX(targetX, 0.3f).SetDelay(delay).SetEase(Ease.InSine);
|
}
|
|
m_CanvasGroup.DOFade(targetAlpha, 0.3f).SetDelay(delay).SetEase(active ? Ease.OutSine : Ease.InSine);
|
m_CanvasGroup.blocksRaycasts = active;
|
}
|
|
public void SwitchImmediately(bool active, float offset)
|
{
|
targetX = active ? 0 : 120f + SafeAreaUI.SafeWidth + offset;
|
targetAlpha = active ? 1f : 0f;
|
m_Content.anchoredPosition = m_Content.anchoredPosition.SetX(targetX);
|
m_CanvasGroup.alpha = targetAlpha;
|
m_CanvasGroup.blocksRaycasts = active;
|
}
|
|
public bool IsOpen()
|
{
|
if (m_FunctionId > 0)
|
{
|
return FuncOpen.Instance.IsFuncOpen(m_FunctionId);
|
}
|
|
return true;
|
}
|
|
}
|
|
}
|