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(); 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(); } } }