1
This commit is contained in:
44
Assets/Scripts/UI/Base/UIPageBase.cs
Normal file
44
Assets/Scripts/UI/Base/UIPageBase.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Ichni.UI
|
||||
{
|
||||
public class UIPageBase : SerializedMonoBehaviour
|
||||
{
|
||||
public CanvasGroup mainCanvasGroup;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
CanvasGroup group = GetComponent<CanvasGroup>();
|
||||
if (group != null)
|
||||
{
|
||||
mainCanvasGroup ??= group;
|
||||
}
|
||||
}
|
||||
|
||||
public void FadeIn(float duration = 0.5f)
|
||||
{
|
||||
mainCanvasGroup.gameObject.SetActive(true);
|
||||
mainCanvasGroup.DOFade(1f, duration).OnComplete(() =>
|
||||
{
|
||||
mainCanvasGroup.interactable = true;
|
||||
mainCanvasGroup.blocksRaycasts = true;
|
||||
}).Play();
|
||||
}
|
||||
|
||||
public void FadeOut(float duration = 0.5f)
|
||||
{
|
||||
mainCanvasGroup.interactable = false;
|
||||
mainCanvasGroup.blocksRaycasts = false;
|
||||
mainCanvasGroup.DOFade(0f, duration).OnComplete(() =>
|
||||
{
|
||||
mainCanvasGroup.gameObject.SetActive(false);
|
||||
}).Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Base/UIPageBase.cs.meta
Normal file
11
Assets/Scripts/UI/Base/UIPageBase.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5131dcefd0f7134b8d7c8956e949e52
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user