2025-01-07 16:43:54 +08:00
|
|
|
|
using AxibugEmuOnline.Client.ClientCore;
|
2024-12-11 21:21:27 +08:00
|
|
|
|
using AxibugEmuOnline.Client.UI;
|
2025-01-07 17:01:05 +08:00
|
|
|
|
using Coffee.UIExtensions;
|
2024-12-11 21:21:27 +08:00
|
|
|
|
using DG.Tweening;
|
|
|
|
|
using DG.Tweening.Core;
|
|
|
|
|
using DG.Tweening.Plugins.Options;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
namespace AxibugEmuOnline.Client
|
|
|
|
|
{
|
|
|
|
|
public class LaunchUI : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
[SerializeField]
|
|
|
|
|
RectTransform MainMenuRoot;
|
|
|
|
|
[SerializeField]
|
|
|
|
|
MainMenuController MainMenu;
|
2025-01-07 16:43:54 +08:00
|
|
|
|
[SerializeField]
|
|
|
|
|
Image XMBBackground;
|
|
|
|
|
[SerializeField]
|
|
|
|
|
Image RomPreviewBigPic;
|
|
|
|
|
[SerializeField]
|
|
|
|
|
CanvasGroup XMBCG_For_RomPreviewBigPic;
|
2024-12-11 21:21:27 +08:00
|
|
|
|
|
|
|
|
|
Vector2 m_mainLayoutPosition;
|
|
|
|
|
[SerializeField]
|
2024-12-13 15:42:37 +08:00
|
|
|
|
float m_detailLayoutPosition_x = 55;
|
2024-12-11 21:21:27 +08:00
|
|
|
|
[SerializeField]
|
|
|
|
|
float m_LayoutChangeSpeed = 10;
|
|
|
|
|
|
|
|
|
|
public static LaunchUI Instance { get; private set; }
|
|
|
|
|
|
|
|
|
|
TweenerCore<Vector2, Vector2, VectorOptions> m_layoutTween;
|
2025-01-07 16:43:54 +08:00
|
|
|
|
AlphaWraper romPreviewWraper;
|
2024-12-11 21:21:27 +08:00
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
m_mainLayoutPosition = MainMenuRoot.anchoredPosition;
|
|
|
|
|
MainMenu.ListenControlAction = true;
|
2025-01-07 16:43:54 +08:00
|
|
|
|
romPreviewWraper = new AlphaWraper(XMBCG_For_RomPreviewBigPic, RomPreviewBigPic.GetComponent<CanvasGroup>(), false);
|
2025-01-07 17:01:05 +08:00
|
|
|
|
|
|
|
|
|
var uiEffect = RomPreviewBigPic.GetComponent<UIEffect>();
|
|
|
|
|
if (Application.platform == RuntimePlatform.PSP2)
|
|
|
|
|
uiEffect.blurMode = BlurMode.FastBlur;
|
|
|
|
|
else
|
|
|
|
|
uiEffect.blurMode = BlurMode.DetailBlur;
|
2024-12-11 21:21:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
CommandDispatcher.Instance.Current = CommandDispatcher.Instance.Normal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
if (CommandDispatcher.Instance.Current == CommandDispatcher.Instance.Gaming && App.emu.Core.IsNull())
|
|
|
|
|
CommandDispatcher.Instance.Current = CommandDispatcher.Instance.Normal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void HideMainMenu()
|
|
|
|
|
{
|
2025-01-07 16:43:54 +08:00
|
|
|
|
XMBBackground.gameObject.SetActiveEx(false);
|
2024-12-11 21:21:27 +08:00
|
|
|
|
MainMenuRoot.gameObject.SetActiveEx(false);
|
2025-01-07 16:43:54 +08:00
|
|
|
|
RomPreviewBigPic.gameObject.SetActiveEx(false);
|
2024-12-11 21:21:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowMainMenu()
|
|
|
|
|
{
|
2025-01-07 16:43:54 +08:00
|
|
|
|
XMBBackground.gameObject.SetActiveEx(true);
|
2024-12-11 21:21:27 +08:00
|
|
|
|
MainMenuRoot.gameObject.SetActiveEx(true);
|
2025-01-07 16:43:54 +08:00
|
|
|
|
|
|
|
|
|
if (romPreviewWraper.On)
|
|
|
|
|
{
|
|
|
|
|
XMBCG_For_RomPreviewBigPic.gameObject.SetActive(false);
|
|
|
|
|
RomPreviewBigPic.gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
else if (!romPreviewWraper.On)
|
|
|
|
|
{
|
|
|
|
|
XMBCG_For_RomPreviewBigPic.gameObject.SetActive(true);
|
|
|
|
|
XMBCG_For_RomPreviewBigPic.alpha = 1;
|
|
|
|
|
RomPreviewBigPic.gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void HideRomPreview()
|
|
|
|
|
{
|
|
|
|
|
romPreviewWraper.On = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetRomPreview(Sprite sp)
|
|
|
|
|
{
|
|
|
|
|
if (MainMenu.ListenControlAction) return;
|
|
|
|
|
|
|
|
|
|
RomPreviewBigPic.sprite = sp;
|
|
|
|
|
romPreviewWraper.On = true;
|
2024-12-11 21:21:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ToDetailMenuLayout()
|
|
|
|
|
{
|
|
|
|
|
if (m_layoutTween != null)
|
|
|
|
|
{
|
|
|
|
|
m_layoutTween.Kill();
|
|
|
|
|
m_layoutTween = null;
|
|
|
|
|
}
|
|
|
|
|
m_layoutTween = DOTween
|
|
|
|
|
.To(
|
|
|
|
|
() => MainMenuRoot.anchoredPosition,
|
|
|
|
|
(x) => MainMenuRoot.anchoredPosition = x,
|
2024-12-13 15:42:37 +08:00
|
|
|
|
new Vector2(m_detailLayoutPosition_x, MainMenuRoot.anchoredPosition.y),
|
2024-12-11 21:21:27 +08:00
|
|
|
|
m_LayoutChangeSpeed)
|
|
|
|
|
.SetSpeedBased();
|
|
|
|
|
MainMenu.ListenControlAction = false;
|
|
|
|
|
MainMenu.EnterDetailState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ToMainMenuLayout()
|
|
|
|
|
{
|
|
|
|
|
if (m_layoutTween != null)
|
|
|
|
|
{
|
|
|
|
|
m_layoutTween.Kill();
|
|
|
|
|
m_layoutTween = null;
|
|
|
|
|
}
|
|
|
|
|
m_layoutTween = DOTween.To(
|
|
|
|
|
() => MainMenuRoot.anchoredPosition,
|
|
|
|
|
(x) => MainMenuRoot.anchoredPosition = x,
|
|
|
|
|
m_mainLayoutPosition,
|
|
|
|
|
m_LayoutChangeSpeed)
|
|
|
|
|
.SetSpeedBased();
|
|
|
|
|
MainMenu.ListenControlAction = true;
|
|
|
|
|
MainMenu.ExitDetailState();
|
2025-01-07 16:43:54 +08:00
|
|
|
|
|
|
|
|
|
HideRomPreview();
|
2024-12-11 21:21:27 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|