2022-04-05 14:06:17 +02:00
|
|
|
using UnityEngine;
|
2022-04-05 14:30:25 +02:00
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
using UnityEngine.UI;
|
2022-04-05 14:06:17 +02:00
|
|
|
|
|
|
|
|
public class TrainingSubOption : MonoBehaviour
|
|
|
|
|
{
|
2022-04-05 14:30:25 +02:00
|
|
|
[SerializeField] private Selectable _initialSelectable = default;
|
|
|
|
|
private Selectable _currentInitialSelectable;
|
2022-04-05 14:06:17 +02:00
|
|
|
|
2022-04-05 14:30:25 +02:00
|
|
|
|
|
|
|
|
public void Activate()
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
|
if (_currentInitialSelectable == null)
|
|
|
|
|
{
|
|
|
|
|
_currentInitialSelectable = _initialSelectable;
|
|
|
|
|
}
|
|
|
|
|
_currentInitialSelectable.Select();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Disable()
|
|
|
|
|
{
|
2022-04-05 16:08:11 +02:00
|
|
|
if (gameObject.activeSelf)
|
|
|
|
|
{
|
|
|
|
|
_currentInitialSelectable = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>();
|
|
|
|
|
}
|
2022-04-05 14:30:25 +02:00
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
}
|
2022-04-05 14:06:17 +02:00
|
|
|
}
|