Finished converting to new UI.
This commit is contained in:
parent
f70f89324b
commit
105055b307
37 changed files with 24044 additions and 1227 deletions
46
PuzzleGameProject/Assets/Scripts/UI/ChestPopUpController.cs
Normal file
46
PuzzleGameProject/Assets/Scripts/UI/ChestPopUpController.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class ChestPopUpController : MonoBehaviour
|
||||
{
|
||||
public event Action BlackDieSelected;
|
||||
public event Action KeySelected;
|
||||
public event Action ArmorAndDiamondSelected;
|
||||
|
||||
private Button _blackDie;
|
||||
private Button _key;
|
||||
private Button _armorAndDiamond;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
VisualElement root = GetComponent<UIDocument>().rootVisualElement;
|
||||
|
||||
_blackDie = root.Q<Button>("BlackDie");
|
||||
_blackDie.clicked += () => BlackDieSelected?.Invoke();
|
||||
|
||||
_key = root.Q<Button>("Key");
|
||||
_key.clicked += () => KeySelected?.Invoke();
|
||||
|
||||
_armorAndDiamond = root.Q<Button>("ArmorAndDiamond");
|
||||
_armorAndDiamond.clicked += () => ArmorAndDiamondSelected?.Invoke();
|
||||
}
|
||||
|
||||
public void DisableBlackDie()
|
||||
{
|
||||
_blackDie.SetEnabled(false);
|
||||
}
|
||||
|
||||
public void DisableKey()
|
||||
{
|
||||
_key.SetEnabled(false);
|
||||
}
|
||||
|
||||
public void DisableArmorAndDiamond()
|
||||
{
|
||||
_armorAndDiamond.SetEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue