You've already forked taptap2024_GJ_chidouren
105 lines
3.9 KiB
C#
105 lines
3.9 KiB
C#
using Game.Component;
|
|
using Script.Core.Utils.Extend;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.UI;
|
|
|
|
namespace System
|
|
{
|
|
public class BeginStaticPanel : MonoBehaviour
|
|
{
|
|
private static readonly string BeginStaticPanelPath = "BeginStaticPanel";
|
|
private static BeginStaticPanel _instance;
|
|
|
|
public static void Create ()
|
|
{
|
|
if (!ReferenceEquals (null , _instance))
|
|
return;
|
|
BeginStaticPanel beginStaticPanel = UnityEngine.Resources.Load<BeginStaticPanel> (BeginStaticPanelPath);
|
|
_instance = GameObject.Instantiate (beginStaticPanel);
|
|
_instance._yongTipBtn.onClick.AddListener (_instance.ShowYongTip);
|
|
ShowAssetUpdater ();
|
|
}
|
|
|
|
public static void ReleasePanel ()
|
|
{
|
|
if (ReferenceEquals (null , _instance))
|
|
return;
|
|
Destroy (_instance.gameObject);
|
|
UnityEngine.Resources.UnloadUnusedAssets ();
|
|
_instance = null;
|
|
}
|
|
|
|
public static void ShowAssetUpdater ()
|
|
{
|
|
if (ReferenceEquals (null , _instance))
|
|
return;
|
|
_instance._updaterRoot.gameObject.SetActive (true);
|
|
_instance._loginRoot.gameObject.SetActive (false);
|
|
}
|
|
|
|
public static void ShowLoginBtn (UnityAction callback)
|
|
{
|
|
if (ReferenceEquals (null , _instance))
|
|
return;
|
|
_instance._tapLoginBtn.onClick.RemoveAllListeners ();
|
|
_instance._tapLoginBtn.onClick.AddListener (callback);
|
|
_instance._updaterRoot.gameObject.SetActive (false);
|
|
_instance._loginRoot.gameObject.SetActive (true);
|
|
_instance._tapLoginBtn.gameObject.SetActive(true);
|
|
}
|
|
|
|
// [SerializeField] private Updater _updater;
|
|
[SerializeField] private Button _tapLoginBtn;
|
|
[SerializeField] private Button _yongTipBtn;
|
|
[SerializeField] private GameObject _updaterRoot;
|
|
[SerializeField] private GameObject _loginRoot;
|
|
[SerializeField] private GameSlider _gameSlider;
|
|
[SerializeField] private GameObject _gameLoading;
|
|
[SerializeField] private UnityEngine.UI.Text _loadText;
|
|
|
|
// public static Updater Updater => _instance._updater;
|
|
|
|
private void ShowYongTip ()
|
|
{
|
|
//todo 展示适龄提醒
|
|
}
|
|
|
|
public static void OnMessage (string str)
|
|
{
|
|
if (ReferenceEquals (null , _instance))
|
|
return;
|
|
_instance._updaterRoot.gameObject.SetActive (true);
|
|
_instance._loginRoot.gameObject.SetActive (false);
|
|
_instance._tapLoginBtn.gameObject.SetActive (false);
|
|
_instance._yongTipBtn.gameObject.SetActive (true);
|
|
_instance._gameSlider.gameObject.SetActive (false);
|
|
_instance._gameLoading.gameObject.SetActive (true);
|
|
|
|
_instance._loadText.text = str;
|
|
}
|
|
|
|
public static void ShowMessage (string str , float progress)
|
|
{
|
|
if (ReferenceEquals (null , _instance))
|
|
return;
|
|
_instance._updaterRoot.gameObject.SetActive (true);
|
|
_instance._loginRoot.gameObject.SetActive (false);
|
|
_instance._tapLoginBtn.gameObject.SetActive (false);
|
|
_instance._yongTipBtn.gameObject.SetActive (false);
|
|
_instance._gameSlider.gameObject.SetActive (true);
|
|
_instance._gameLoading.gameObject.SetActive (false);
|
|
|
|
_instance._loadText.text = str;
|
|
_instance._gameSlider.Value = progress;
|
|
_instance._gameSlider.ProgressText = $"{progress.ToPercentageString ()}";
|
|
}
|
|
|
|
public static void ShowMessageBox (string str , Action callback)
|
|
{
|
|
if (ReferenceEquals (null , _instance))
|
|
return;
|
|
|
|
}
|
|
}
|
|
} |