75 lines
2.3 KiB
C#
75 lines
2.3 KiB
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using DG.Tweening;
|
||
using IchniOnline.Online.Logic;
|
||
using SLSUtilities.WwiseAssistance;
|
||
using UnityEngine;
|
||
using UnityEngine.Serialization;
|
||
|
||
namespace Ichni.UI
|
||
{
|
||
public class StartUIPage : UIPageBase
|
||
{
|
||
//public List<ParticleSystem> logoParticles;
|
||
public ParticleSystem floatingParticles;
|
||
|
||
public GameObject peWarningWindow;
|
||
public GameObject contentWindow;
|
||
|
||
[Header("Login")]
|
||
public LoginPage loginPage;
|
||
|
||
protected override void Awake()
|
||
{
|
||
base.Awake();
|
||
}
|
||
|
||
private void Start()
|
||
{
|
||
Sequence peWarningSequence = DOTween.Sequence();
|
||
peWarningSequence.Append(peWarningWindow.GetComponent<CanvasGroup>().DOFade(1f, 0.5f));
|
||
peWarningSequence.AppendInterval(1f);
|
||
peWarningSequence.Append(peWarningWindow.GetComponent<CanvasGroup>().DOFade(0f, 0.5f).OnStart(() => contentWindow.SetActive(true)));
|
||
peWarningSequence.AppendCallback(() =>
|
||
{
|
||
peWarningWindow.SetActive(false);
|
||
floatingParticles.Play();
|
||
});
|
||
peWarningSequence.Play();
|
||
}
|
||
|
||
public void TouchToStart()
|
||
{
|
||
AudioManager.Post(AK.EVENTS.TOUCHTOSTART);
|
||
|
||
// 已有登录缓存 → 跳过 LoginPage,直接进入章节选择
|
||
if (LoginCacheManager.HasValidSession)
|
||
{
|
||
FadeOut();
|
||
floatingParticles.GetComponent<Renderer>().material.DOColor(Color.clear, "_BaseColor", 0.5f).Play();
|
||
ChapterSelectionManager.instance.chapterSelectionUIPage.FadeIn();
|
||
return;
|
||
}
|
||
|
||
// 未登录 → 禁用 StartPage 交互,显示 LoginPage 覆盖层
|
||
mainCanvasGroup.interactable = false;
|
||
mainCanvasGroup.blocksRaycasts = false;
|
||
|
||
if (loginPage != null)
|
||
{
|
||
loginPage.FadeIn();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// LoginPage 关闭后调用,恢复 StartPage 的交互
|
||
/// </summary>
|
||
public void RestoreInteraction()
|
||
{
|
||
mainCanvasGroup.interactable = true;
|
||
mainCanvasGroup.blocksRaycasts = true;
|
||
}
|
||
}
|
||
}
|