r2mods/ilspy_dump/ror2_csproj/RoR2.UI.MainMenu/BaseMainMenuScreen.cs

65 lines
1.3 KiB
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
using UnityEngine.Events;
namespace RoR2.UI.MainMenu;
[RequireComponent(typeof(RectTransform))]
public class BaseMainMenuScreen : MonoBehaviour
{
public Transform desiredCameraTransform;
[HideInInspector]
public bool shouldDisplay;
protected MainMenuController myMainMenuController;
protected FirstSelectedObjectProvider firstSelectedObjectProvider;
public UnityEvent onEnter;
public UnityEvent onExit;
public void Awake()
{
firstSelectedObjectProvider = GetComponent<FirstSelectedObjectProvider>();
}
public void OnEnable()
{
MainMenuController.instance?.SetAllowTransition(value: true);
}
public virtual bool IsReadyToLeave()
{
return true;
}
public void Update()
{
if (SimpleDialogBox.instancesList.Count == 0)
{
firstSelectedObjectProvider?.EnsureSelectedObject();
}
}
public virtual void OnEnter(MainMenuController mainMenuController)
{
Debug.LogFormat("BaseMainMenuScreen: OnEnter()");
myMainMenuController = mainMenuController;
if (SimpleDialogBox.instancesList.Count == 0)
{
firstSelectedObjectProvider?.EnsureSelectedObject();
}
onEnter.Invoke();
}
public virtual void OnExit(MainMenuController mainMenuController)
{
if (myMainMenuController == mainMenuController)
{
myMainMenuController = null;
}
onExit.Invoke();
}
}