StartMenu!
This commit is contained in:
65
Assets/Scripts/StartMenu/StartPage.cs
Normal file
65
Assets/Scripts/StartMenu/StartPage.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Michsky.MUIP;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Ichni.StartMenu
|
||||
{
|
||||
public partial class StartPage : MonoBehaviour
|
||||
{
|
||||
public RectTransform background;
|
||||
public CanvasGroup canvasGroup;
|
||||
|
||||
public ButtonManager createEmptyProjectButton;
|
||||
|
||||
public Sequence fadeIn, fadeOut;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitializeAnimations();
|
||||
createEmptyProjectButton.onClick.AddListener(GoToNewProjectPage);
|
||||
}
|
||||
|
||||
public void GoToNewProjectPage()
|
||||
{
|
||||
fadeOut.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class StartPage
|
||||
{
|
||||
private void InitializeAnimations()
|
||||
{
|
||||
fadeIn = DOTween.Sequence();
|
||||
fadeOut = DOTween.Sequence();
|
||||
|
||||
fadeIn.Join(canvasGroup.DOFade(1f, 0.5f))
|
||||
.Join(background.DOScale(Vector3.one, 0.5f))
|
||||
.SetEase(Ease.InOutQuad)
|
||||
.SetAutoKill(false)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
canvasGroup.interactable = true;
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
}).Pause();
|
||||
|
||||
fadeOut.Join(canvasGroup.DOFade(0f, 0.5f))
|
||||
.Join(background.DOScale(Vector3.one * 2f, 0.5f))
|
||||
.SetEase(Ease.InOutQuad)
|
||||
.SetAutoKill(false)
|
||||
.OnPlay(() =>
|
||||
{
|
||||
canvasGroup.interactable = false;
|
||||
canvasGroup.blocksRaycasts = false;
|
||||
})
|
||||
.OnComplete(() =>
|
||||
{
|
||||
StartMenuManager.instance.createEmptyProjectPage.fadeIn.Restart();
|
||||
})
|
||||
.Pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user