Files
EnglewoodLAB/Assets/Scripts/UI/CameraController/CameraControlItem.cs
SOOBEEN HAN f1894889ee <refactor> Octopus Twin 템플릿 적용
- 기능 외 UI 구조만 적용
- 프로젝트에 걸맞는 UI는 재작업 필요
2026-02-23 18:20:09 +09:00

44 lines
974 B
C#

using EnglewoodLAB.Object;
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace EnglewoodLAB.UI
{
[RequireComponent(typeof(Button))]
public class CameraControlItem : MonoBehaviour
{
public CameraPoint point;
public int floorIndex;
private Button button;
public Action<CameraControlItem> OnItemClicked;
public void SettingButton(CameraPoint point)
{
gameObject.name = $"{point.name}_Button";
this.point = point;
floorIndex = point.floorIndex;
button = GetComponent<Button>();
var buttonText = GetComponentInChildren<TMP_Text>();
if (buttonText != null)
{
buttonText.SetText(point.name);
}
button.onClick.AddListener(HandleClick);
}
private void HandleClick()
{
OnItemClicked?.Invoke(this);
}
}
}