65 lines
1.4 KiB
C#
65 lines
1.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class BlueprintSlotButton : MonoBehaviour, IDeselectHandler
|
|
{
|
|
public int m_id = 0;
|
|
BlueprintScroll m_scroll;
|
|
public Button m_button;
|
|
public SignObject m_sign;
|
|
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);
|
|
}
|
|
|
|
public void SetSign(SignObject sign)
|
|
{
|
|
m_sign = sign;
|
|
m_image.sprite = sign.image;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
m_button.onClick.RemoveAllListeners();
|
|
}
|
|
void OnClick()
|
|
{
|
|
if (m_scroll)
|
|
{
|
|
m_scroll.OnSlotClicked(this);
|
|
}
|
|
}
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
//void SetSpr
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
void SetSprite(Sprite sp)
|
|
{
|
|
|
|
}
|
|
|
|
public void OnDeselect(BaseEventData eventData)
|
|
{
|
|
m_scroll.OnDeselect(this);
|
|
}
|
|
}
|
|
} |