2024-11-21 17:18:15 +08:00
|
|
|
using AxibugEmuOnline.Client.ClientCore;
|
2024-08-21 16:28:23 +08:00
|
|
|
using AxibugEmuOnline.Client.UI;
|
|
|
|
using DG.Tweening;
|
|
|
|
using DG.Tweening.Core;
|
|
|
|
using DG.Tweening.Plugins.Options;
|
|
|
|
using UnityEngine;
|
2024-09-13 13:28:33 +08:00
|
|
|
using UnityEngine.UI;
|
2024-08-21 16:28:23 +08:00
|
|
|
|
|
|
|
namespace AxibugEmuOnline.Client
|
|
|
|
{
|
|
|
|
public class LaunchUI : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField]
|
|
|
|
RectTransform MainMenuRoot;
|
|
|
|
[SerializeField]
|
|
|
|
MainMenuController MainMenu;
|
2024-11-28 10:08:49 +08:00
|
|
|
public Image BG;
|
2024-08-21 16:28:23 +08:00
|
|
|
|
|
|
|
Vector2 m_mainLayoutPosition;
|
|
|
|
[SerializeField]
|
|
|
|
Vector2 m_detailLayoutPosition;
|
|
|
|
[SerializeField]
|
|
|
|
float m_LayoutChangeSpeed = 10;
|
|
|
|
|
|
|
|
public static LaunchUI Instance { get; private set; }
|
|
|
|
|
|
|
|
TweenerCore<Vector2, Vector2, VectorOptions> m_layoutTween;
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
Instance = this;
|
|
|
|
m_mainLayoutPosition = MainMenuRoot.anchoredPosition;
|
|
|
|
MainMenu.ListenControlAction = true;
|
|
|
|
}
|
|
|
|
|
2024-09-23 18:15:34 +08:00
|
|
|
private void Start()
|
|
|
|
{
|
2024-11-21 20:32:41 +08:00
|
|
|
CommandDispatcher.Instance.Current = CommandDispatcher.Instance.Normal;
|
2024-09-23 18:15:34 +08:00
|
|
|
}
|
|
|
|
|
2024-12-04 00:04:31 +08:00
|
|
|
private void Update()
|
|
|
|
{
|
|
|
|
if (CommandDispatcher.Instance.Current == CommandDispatcher.Instance.Gaming && App.emu.Core.IsNull())
|
|
|
|
CommandDispatcher.Instance.Current = CommandDispatcher.Instance.Normal;
|
|
|
|
}
|
|
|
|
|
2024-09-11 16:33:48 +08:00
|
|
|
public void HideMainMenu()
|
|
|
|
{
|
2024-09-13 13:28:33 +08:00
|
|
|
BG.gameObject.SetActiveEx(false);
|
2024-09-11 16:33:48 +08:00
|
|
|
MainMenuRoot.gameObject.SetActiveEx(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ShowMainMenu()
|
|
|
|
{
|
2024-09-13 13:28:33 +08:00
|
|
|
BG.gameObject.SetActiveEx(true);
|
2024-09-11 16:33:48 +08:00
|
|
|
MainMenuRoot.gameObject.SetActiveEx(true);
|
|
|
|
}
|
2024-08-21 16:28:23 +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,
|
|
|
|
m_detailLayoutPosition,
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|