You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
2.7 KiB
92 lines
2.7 KiB
using JetBrains.Annotations; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
using Utils; |
|
using TMPro; |
|
|
|
namespace Special |
|
{ |
|
public class AngelHelp : BaseDialog |
|
{ |
|
[SerializeField] private Ability _healAbility; |
|
[SerializeField] private Ability[] _abilities; |
|
[SerializeField] private AbilityItem _item; |
|
[SerializeField] private RectTransform _container; |
|
[SerializeField] private bool _interactable; |
|
|
|
[SerializeField] private GameObject _headerText; |
|
[SerializeField] private GameObject _looseText; |
|
[SerializeField] private GameObject _getText; |
|
[SerializeField] private Button _acceptButton; |
|
[SerializeField] private Button _declineButton; |
|
|
|
private Ability _abInfo; |
|
|
|
private void Awake() |
|
{ |
|
_abInfo = _abilities[Random.Range(0, _abilities.Length)]; |
|
_item.Create(_healAbility, _container, _interactable); |
|
_item.Create(_abInfo, _container, _interactable); |
|
} |
|
|
|
private void InitTexts() |
|
{ |
|
if (_headerText) |
|
{ |
|
int txtId = 39; |
|
if (name.IndexOf("Angel") != -1) |
|
txtId = 44; |
|
|
|
_headerText.GetComponent<TextMeshProUGUI>().text = GlobalsVar.gGameTextMng.GetGameText(txtId).ToUpper(); |
|
} |
|
|
|
if (_acceptButton) |
|
CommonFunctions.SetButtonText(_acceptButton.gameObject, GlobalsVar.gGameTextMng.GetGameText(40).ToUpper()); |
|
|
|
if (_declineButton) |
|
CommonFunctions.SetButtonText(_declineButton.gameObject, GlobalsVar.gGameTextMng.GetGameText(41).ToUpper()); |
|
|
|
if (_looseText) |
|
{ |
|
int txtId = 42; |
|
if (name.IndexOf("Angel") != -1) |
|
txtId = 45; |
|
|
|
_looseText.GetComponent<TextMeshProUGUI>().text = GlobalsVar.gGameTextMng.GetGameText(txtId).ToUpper(); |
|
} |
|
|
|
if (_getText) |
|
_getText.GetComponent<TextMeshProUGUI>().text = GlobalsVar.gGameTextMng.GetGameText(43).ToUpper(); |
|
} |
|
|
|
private void Start() |
|
{ |
|
SoundsManager.Instance.PlaySound("level_up"); |
|
|
|
var currentRect = GetComponent<RectTransform>(); |
|
currentRect.SetRight(0); |
|
currentRect.SetLeft(0); |
|
currentRect.SetBottom(0); |
|
currentRect.SetTop(0); |
|
currentRect.localScale = Vector3.one; |
|
|
|
m_type = !_interactable ? DialogType.DEVIL : DialogType.ANGEL; |
|
InitTexts(); |
|
} |
|
|
|
[UsedImplicitly] |
|
public void Accept() |
|
{ |
|
if (GlobalsVar.gBoard) |
|
{ |
|
GameBoard gameBoard = GlobalsVar.gBoard as GameBoard; |
|
if (gameBoard != null) |
|
{ |
|
gameBoard.MainCharacter.AddAbility(_abInfo.AbType); |
|
gameBoard.MainCharacter.AddAbility(_healAbility.AbType); |
|
HideDialog(); |
|
} |
|
} |
|
} |
|
} |
|
}
|
|
|