32 lines
743 B
C#
32 lines
743 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using CHN;
|
|
using TMPro;
|
|
using WI;
|
|
|
|
public class UI_LibraryButton : UIBase
|
|
{
|
|
public Machine machine;
|
|
public event Action<UI_LibraryButton> onClickButton;
|
|
public Image PreviewImage;
|
|
|
|
public void SettingButton(Machine machine)
|
|
{
|
|
this.machine = machine;
|
|
|
|
var button = GetComponent<Button>();
|
|
var buttonText = button.GetComponentInChildren<TMP_Text>();
|
|
buttonText.SetText(machine.name);
|
|
button.onClick.AddListener(OnButtonClick);
|
|
|
|
PreviewImage.sprite = machine.previewImage;
|
|
}
|
|
private void OnButtonClick()
|
|
{
|
|
onClickButton?.Invoke(this);
|
|
}
|
|
}
|