2022-10-17 19:11:28 +02:00
|
|
|
using System.Text.RegularExpressions;
|
2022-07-07 18:35:18 +03:00
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
2022-07-08 12:47:51 +03:00
|
|
|
using UnityEngine.EventSystems;
|
2022-10-17 10:53:16 +02:00
|
|
|
using UnityEngine.UI;
|
2022-07-08 12:08:03 +03:00
|
|
|
using UnityEngine.Video;
|
2022-07-07 18:35:18 +03:00
|
|
|
|
|
|
|
|
public class CommandListMenu : BaseMenu
|
|
|
|
|
{
|
2022-10-17 10:53:16 +02:00
|
|
|
[SerializeField] private TextMeshProUGUI[] _characterText = default;
|
2022-09-22 19:17:03 +03:00
|
|
|
[SerializeField] private TextMeshProUGUI _descriptionText = default;
|
|
|
|
|
[SerializeField] private VideoPlayer _showcaseVideo = default;
|
|
|
|
|
[SerializeField] private PauseMenu _pauseMenu = default;
|
|
|
|
|
[SerializeField] private PauseMenu _pauseTrainingMenu = default;
|
2022-10-17 10:53:16 +02:00
|
|
|
[SerializeField] private RectTransform _characterContent = default;
|
2022-10-18 21:15:06 +03:00
|
|
|
[SerializeField] private RectTransform _normalsContent = default;
|
2022-10-17 10:53:16 +02:00
|
|
|
[SerializeField] private RectTransform _commonContent = default;
|
2022-10-18 21:15:06 +03:00
|
|
|
[SerializeField] private GameObject _demonLimitPage = default;
|
2022-10-17 10:53:16 +02:00
|
|
|
[SerializeField] private GameObject _characterMovesPage = default;
|
|
|
|
|
[SerializeField] private GameObject _commonMovesPage = default;
|
|
|
|
|
[SerializeField] private Button _characterMovesButton = default;
|
2022-10-18 21:15:06 +03:00
|
|
|
[SerializeField] private Button _normalMovesButton = default;
|
2022-10-17 10:53:16 +02:00
|
|
|
[SerializeField] private Button _commonMovesButton = default;
|
|
|
|
|
[SerializeField] private GameObject[] _slides = default;
|
2022-10-17 20:49:31 +02:00
|
|
|
[SerializeField] private GameObject[] _subSlides = default;
|
2022-09-22 19:17:03 +03:00
|
|
|
[SerializeField] private CommandFramedata _commandFramedata = default;
|
|
|
|
|
[SerializeField] private CommandListButton[] _commandListButtons = default;
|
2022-09-25 16:08:45 +03:00
|
|
|
[SerializeField] private GameObject _toggleFramedataPrompt = default;
|
2022-09-22 19:17:03 +03:00
|
|
|
[SerializeField] private GameObject _knockdownImage = default;
|
|
|
|
|
[SerializeField] private GameObject _reversalImage = default;
|
|
|
|
|
[SerializeField] private GameObject _projectileImage = default;
|
|
|
|
|
[SerializeField] private GameObject _videoMenu = default;
|
|
|
|
|
[SerializeField] private GameObject _framedataMenu = default;
|
2022-10-17 10:53:16 +02:00
|
|
|
private int _currentPage;
|
2022-09-22 19:17:03 +03:00
|
|
|
private Player _playerOne;
|
|
|
|
|
private Player _playerTwo;
|
|
|
|
|
private Player _currentlyDisplayedPlayer;
|
2023-11-30 21:07:22 +02:00
|
|
|
private readonly string _baseUrl = "https://kidagine.github.io/Darklings-CommandListVideos/";
|
2022-07-07 18:35:18 +03:00
|
|
|
|
2022-09-22 19:17:03 +03:00
|
|
|
public PauseMenu CurrentPauseMenu { get; private set; }
|
2022-07-07 18:35:18 +03:00
|
|
|
|
2022-09-22 19:17:03 +03:00
|
|
|
void Awake()
|
|
|
|
|
{
|
2022-12-04 21:35:31 +02:00
|
|
|
_playerOne = GameplayManager.Instance.PlayerOne;
|
|
|
|
|
_playerTwo = GameplayManager.Instance.PlayerTwo;
|
2023-11-03 13:45:29 +02:00
|
|
|
string playerOne = Regex.Replace(_playerOne.PlayerStats.characterName.ToString(), "([a-z])([A-Z])", "$1 $2");
|
|
|
|
|
string playerTwo = Regex.Replace(_playerTwo.PlayerStats.characterName.ToString(), "([a-z])([A-Z])", "$1 $2");
|
|
|
|
|
_characterText[0].text = playerOne;
|
|
|
|
|
_characterText[1].text = playerTwo;
|
2022-09-22 19:17:03 +03:00
|
|
|
}
|
2022-07-07 18:35:18 +03:00
|
|
|
|
2022-10-17 20:49:31 +02:00
|
|
|
public void NextSubPage()
|
|
|
|
|
{
|
2022-10-18 21:15:06 +03:00
|
|
|
if (_characterMovesPage.activeSelf)
|
2022-10-17 20:49:31 +02:00
|
|
|
{
|
2022-10-18 21:15:06 +03:00
|
|
|
EventSystem.current.SetSelectedGameObject(null);
|
|
|
|
|
if (_subSlides[0].activeSelf)
|
|
|
|
|
{
|
|
|
|
|
_subSlides[0].SetActive(false);
|
|
|
|
|
_subSlides[1].SetActive(true);
|
|
|
|
|
_characterContent.anchoredPosition = Vector2.zero;
|
|
|
|
|
_characterMovesButton.Select();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_subSlides[0].SetActive(true);
|
|
|
|
|
_subSlides[1].SetActive(false);
|
|
|
|
|
_normalsContent.anchoredPosition = Vector2.zero;
|
|
|
|
|
_normalMovesButton.Select();
|
|
|
|
|
}
|
2022-10-17 20:49:31 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-03 13:45:29 +02:00
|
|
|
public void SetCharacterMenu(int index)
|
2022-10-17 10:53:16 +02:00
|
|
|
{
|
2023-11-03 13:45:29 +02:00
|
|
|
if (_playerOne == null)
|
|
|
|
|
return;
|
|
|
|
|
if (index == 0)
|
2022-10-17 10:53:16 +02:00
|
|
|
SetCommandListData(_playerOne.playerStats);
|
|
|
|
|
else
|
|
|
|
|
SetCommandListData(_playerTwo.playerStats);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-03 13:45:29 +02:00
|
|
|
public void SetInfoMenu(int index)
|
2022-10-17 10:53:16 +02:00
|
|
|
{
|
2023-11-03 13:45:29 +02:00
|
|
|
for (int i = 0; i < _subSlides.Length; i++)
|
|
|
|
|
_subSlides[i].SetActive(false);
|
|
|
|
|
_subSlides[index].SetActive(true);
|
|
|
|
|
_currentPage = index;
|
|
|
|
|
if (index == 0)
|
|
|
|
|
_startingOption.Select();
|
|
|
|
|
else if (index == 1)
|
|
|
|
|
_normalMovesButton.Select();
|
|
|
|
|
else if (index == 2)
|
|
|
|
|
_commonMovesButton.Select();
|
|
|
|
|
_normalsContent.anchoredPosition = Vector2.zero;
|
|
|
|
|
_characterContent.anchoredPosition = Vector2.zero;
|
2022-10-17 10:53:16 +02:00
|
|
|
}
|
|
|
|
|
|
2022-10-18 21:15:06 +03:00
|
|
|
private bool AreBothCharactersSame()
|
|
|
|
|
{
|
|
|
|
|
if (_playerOne.playerStats.characterIndex == _playerTwo.playerStats.characterIndex)
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-17 10:53:16 +02:00
|
|
|
private void SetPageInfo()
|
|
|
|
|
{
|
2022-10-18 21:15:06 +03:00
|
|
|
_demonLimitPage.SetActive(false);
|
2022-10-17 10:53:16 +02:00
|
|
|
for (int i = 0; i < _slides.Length; i++)
|
|
|
|
|
_slides[i].SetActive(false);
|
|
|
|
|
|
2023-11-03 13:45:29 +02:00
|
|
|
_characterContent.anchoredPosition = Vector2.zero;
|
|
|
|
|
_characterMovesPage.SetActive(true);
|
|
|
|
|
_commonMovesPage.SetActive(false);
|
|
|
|
|
EventSystem.current.SetSelectedGameObject(null);
|
|
|
|
|
if (_currentPage == 0)
|
|
|
|
|
_startingOption.Select();
|
|
|
|
|
else if (_currentPage == 1)
|
|
|
|
|
_normalMovesButton.Select();
|
|
|
|
|
else if (_currentPage == 2)
|
|
|
|
|
_commonMovesButton.Select();
|
2022-09-22 19:17:03 +03:00
|
|
|
}
|
2022-07-07 18:35:18 +03:00
|
|
|
|
2022-09-22 19:17:03 +03:00
|
|
|
private void SetCommandListData(PlayerStatsSO playerStats)
|
|
|
|
|
{
|
|
|
|
|
_commandListButtons[0].SetData(playerStats.m5Arcana);
|
|
|
|
|
_commandListButtons[1].SetData(playerStats.m2Arcana);
|
|
|
|
|
if (playerStats.jArcana != null)
|
|
|
|
|
{
|
|
|
|
|
_commandListButtons[2].SetData(playerStats.jArcana);
|
|
|
|
|
_commandListButtons[2].gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
_commandListButtons[2].gameObject.SetActive(false);
|
2022-09-25 16:08:45 +03:00
|
|
|
_commandListButtons[3].SetData(playerStats.m5L);
|
|
|
|
|
_commandListButtons[4].SetData(playerStats.m2L);
|
|
|
|
|
_commandListButtons[5].SetData(playerStats.jL);
|
|
|
|
|
_commandListButtons[6].SetData(playerStats.m5M);
|
|
|
|
|
_commandListButtons[7].SetData(playerStats.m2M);
|
|
|
|
|
_commandListButtons[8].SetData(playerStats.jM);
|
|
|
|
|
_commandListButtons[9].SetData(playerStats.m5H);
|
|
|
|
|
_commandListButtons[10].SetData(playerStats.m2H);
|
2022-12-04 21:35:31 +02:00
|
|
|
_commandListButtons[11].SetData(playerStats.jH);
|
2022-10-17 10:53:16 +02:00
|
|
|
_commandListButtons[12].SetData(playerStats.mThrow);
|
2022-11-23 17:10:27 +02:00
|
|
|
_commandListButtons[13].SetData(playerStats.mRedFrenzy);
|
|
|
|
|
_commandListButtons[14].SetData(playerStats.mParry);
|
|
|
|
|
_commandListButtons[15].SetData(playerStats.jL);
|
2022-10-17 10:53:16 +02:00
|
|
|
SetPageInfo();
|
2022-09-22 19:17:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetCommandListShowcase(ArcanaSO command)
|
|
|
|
|
{
|
2022-09-25 16:08:45 +03:00
|
|
|
_descriptionText.text = command.moveDescription;
|
2022-07-19 21:39:41 +03:00
|
|
|
#if UNITY_STANDALONE_WIN
|
2022-09-25 16:08:45 +03:00
|
|
|
_showcaseVideo.clip = command.moveVideo;
|
2022-07-19 21:39:41 +03:00
|
|
|
#endif
|
|
|
|
|
#if UNITY_WEBGL
|
2022-09-25 16:08:45 +03:00
|
|
|
_showcaseVideo.url = _baseUrl + command.moveVideo.name + ".mp4";
|
2022-07-19 21:39:41 +03:00
|
|
|
#endif
|
2022-10-18 21:15:06 +03:00
|
|
|
|
2022-09-22 19:17:03 +03:00
|
|
|
_reversalImage.SetActive(false);
|
|
|
|
|
_knockdownImage.SetActive(false);
|
|
|
|
|
_projectileImage.SetActive(false);
|
|
|
|
|
if (command.reversal)
|
|
|
|
|
_reversalImage.SetActive(true);
|
|
|
|
|
if (command.causesKnockdown)
|
|
|
|
|
_knockdownImage.SetActive(true);
|
|
|
|
|
if (command.isProjectile)
|
|
|
|
|
_projectileImage.SetActive(true);
|
|
|
|
|
_commandFramedata.SetFramedata(command);
|
2022-09-25 16:08:45 +03:00
|
|
|
_toggleFramedataPrompt.SetActive(true);
|
2022-10-18 21:15:06 +03:00
|
|
|
if (!_toggleFramedata)
|
|
|
|
|
{
|
|
|
|
|
_videoMenu.SetActive(true);
|
|
|
|
|
_framedataMenu.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
_showcaseVideo.Stop();
|
|
|
|
|
_showcaseVideo.Play();
|
2022-09-25 16:08:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetCommandListShowcase(AttackSO command)
|
|
|
|
|
{
|
2022-10-18 21:15:06 +03:00
|
|
|
_demonLimitPage.SetActive(false);
|
2022-09-25 16:08:45 +03:00
|
|
|
_videoMenu.SetActive(false);
|
|
|
|
|
_framedataMenu.SetActive(true);
|
|
|
|
|
_commandFramedata.SetFramedata(command);
|
|
|
|
|
_toggleFramedataPrompt.SetActive(false);
|
2022-09-22 19:17:03 +03:00
|
|
|
}
|
2022-07-08 00:20:48 +03:00
|
|
|
|
2022-10-18 21:15:06 +03:00
|
|
|
public void SetDemonLimitShowcase()
|
|
|
|
|
{
|
|
|
|
|
_demonLimitPage.SetActive(true);
|
|
|
|
|
_videoMenu.SetActive(false);
|
|
|
|
|
_framedataMenu.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
bool _toggleFramedata;
|
2022-09-22 19:17:03 +03:00
|
|
|
public void ToggleFramedata()
|
|
|
|
|
{
|
2022-09-25 16:08:45 +03:00
|
|
|
if (_toggleFramedataPrompt.activeSelf)
|
2022-10-18 21:15:06 +03:00
|
|
|
{
|
|
|
|
|
if (!_toggleFramedata)
|
2022-09-25 16:08:45 +03:00
|
|
|
{
|
2022-10-18 21:15:06 +03:00
|
|
|
_demonLimitPage.SetActive(false);
|
2022-09-25 16:08:45 +03:00
|
|
|
_videoMenu.SetActive(false);
|
|
|
|
|
_framedataMenu.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-10-18 21:15:06 +03:00
|
|
|
_demonLimitPage.SetActive(false);
|
2022-09-25 16:08:45 +03:00
|
|
|
_videoMenu.SetActive(true);
|
|
|
|
|
_framedataMenu.SetActive(false);
|
|
|
|
|
_showcaseVideo.Stop();
|
|
|
|
|
_showcaseVideo.Play();
|
|
|
|
|
}
|
2022-10-18 21:15:06 +03:00
|
|
|
_toggleFramedata = !_toggleFramedata;
|
|
|
|
|
}
|
2022-09-22 19:17:03 +03:00
|
|
|
}
|
2022-07-15 12:56:29 +03:00
|
|
|
|
2022-09-22 19:17:03 +03:00
|
|
|
public void Back()
|
|
|
|
|
{
|
|
|
|
|
CurrentPauseMenu.Show();
|
|
|
|
|
Hide();
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-03 13:45:29 +02:00
|
|
|
protected override void OnEnable()
|
2022-09-22 19:17:03 +03:00
|
|
|
{
|
2023-11-03 13:45:29 +02:00
|
|
|
base.OnEnable();
|
2022-10-17 10:53:16 +02:00
|
|
|
_characterContent.anchoredPosition = Vector2.zero;
|
|
|
|
|
_commonContent.anchoredPosition = Vector2.zero;
|
2022-12-04 21:35:31 +02:00
|
|
|
if (GameplayManager.Instance.IsTrainingMode)
|
2022-09-22 19:17:03 +03:00
|
|
|
CurrentPauseMenu = _pauseTrainingMenu;
|
|
|
|
|
else
|
|
|
|
|
CurrentPauseMenu = _pauseMenu;
|
2022-10-18 21:15:06 +03:00
|
|
|
if (AreBothCharactersSame())
|
|
|
|
|
_slides[1].transform.parent.gameObject.SetActive(false);
|
2022-10-17 10:53:16 +02:00
|
|
|
if (CurrentPauseMenu.PlayerOnePaused)
|
2022-09-22 19:17:03 +03:00
|
|
|
_currentlyDisplayedPlayer = _playerOne;
|
|
|
|
|
else
|
|
|
|
|
_currentlyDisplayedPlayer = _playerTwo;
|
|
|
|
|
SetCommandListData(_currentlyDisplayedPlayer.PlayerStats);
|
|
|
|
|
}
|
2022-07-07 18:35:18 +03:00
|
|
|
}
|