26.04.03 가상공장 화면 디자인 반영 • 좌측 도구 창, 상단 UI, 하단 UI • 생산 현황판, 알림 현황판 • 설비 라벨, 요약 팝업, 대시보드, 데이터 보드 • 설정창, 미니맵, AI 시뮬레이션 결과창, 나가기 팝업 가상 공장 화면 디자인 변경에 따른 기능 추가 • 미니맵 드래그 및 위치 조정 기능 추가 • UI 상호 작용(호버링, 선택, 위치 이동, 재설정) • UI 기능 추가(상태 표시, 색상)
60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using AZTECHWB.Extensions;
|
|
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
namespace AZTECHWB.UI
|
|
{
|
|
public class LibraryButton : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
|
|
{
|
|
public Machine machine;
|
|
public event Action<LibraryButton> onClickButton;
|
|
|
|
private TMP_Text buttonName;
|
|
private Image background;
|
|
private Image PreviewImage;
|
|
private Image Image_Selected;
|
|
|
|
public void SettingButton(Machine machine)
|
|
{
|
|
this.machine = machine;
|
|
buttonName = transform.GetComponentInChildren<TMP_Text>();
|
|
background = transform.GetComponent<Image>();
|
|
transform.TryGetComponentInChildren(nameof(PreviewImage), out PreviewImage);
|
|
transform.TryGetComponentInChildren(nameof(Image_Selected), out Image_Selected);
|
|
|
|
buttonName.SetText(machine.machineName);
|
|
PreviewImage.sprite = machine.previewImage;
|
|
}
|
|
public void OnSelected()
|
|
{
|
|
buttonName.color = new Color32(251, 251, 251, 255);
|
|
Image_Selected.gameObject.SetActive(true);
|
|
}
|
|
|
|
public void OnDeselected()
|
|
{
|
|
buttonName.color = new Color32(15, 17, 23, 255);
|
|
Image_Selected.gameObject.SetActive(false);
|
|
}
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
background.color = new Color32(255, 255, 255, 255);
|
|
}
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
background.color = new Color32(255, 255, 255, 204);
|
|
}
|
|
|
|
public void OnPointerClick(PointerEventData eventData)
|
|
{
|
|
onClickButton?.Invoke(this);
|
|
}
|
|
}
|
|
}
|
|
|