Files
beyond/Assets/Scripts/UI/Sign/BlueprintSignButton.cs
2024-11-20 15:21:28 +01:00

56 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Beyond
{
public class BlueprintSignButton : MonoBehaviour
{
public Button m_button;
public SignObject m_sign;
BlueprintScroll m_scroll;
public Image m_image;
private void Awake()
{
m_scroll = gameObject.FindComponentUpHierarchy<BlueprintScroll>();
if (m_button == null)
m_button = GetComponent<Button>();
m_button.onClick.AddListener(OnClick);
}
private void OnDestroy()
{
m_button.onClick.RemoveAllListeners();
}
void OnClick()
{
if (m_scroll)
{
m_scroll.OnSignSelected(m_sign);
}
}
public void SetSign(SignObject obj)
{
m_sign = obj;
m_image.sprite = m_sign.image;
//m_image.sprite = testSprite;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
}