45 lines
886 B
C#
45 lines
886 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class MenuLogic
|
|
{
|
|
private List<MenuButton> buttons;
|
|
private int currentIndex = 0;
|
|
|
|
public MenuLogic(List<MenuButton> buttonList)
|
|
{
|
|
buttons = buttonList;
|
|
RefreshUI();
|
|
}
|
|
|
|
private void RefreshUI()
|
|
{
|
|
for (int i = 0; i < buttons.Count; i++)
|
|
{
|
|
// 현재 인덱스만 백그라운드 활성화!
|
|
buttons[i].GlowEffect.SetActive(i == currentIndex);
|
|
}
|
|
}
|
|
|
|
public void MenuMoveUp()
|
|
{
|
|
MenuMove(1);
|
|
}
|
|
|
|
public void MenuMoveDown()
|
|
{
|
|
MenuMove(-1);
|
|
}
|
|
|
|
public void MenuMove(int direction)
|
|
{
|
|
currentIndex = (currentIndex + direction + buttons.Count) % buttons.Count;
|
|
RefreshUI();
|
|
}
|
|
|
|
public void MenuConfirm()
|
|
{
|
|
buttons[currentIndex].ConfirmAction.Invoke();
|
|
}
|
|
}
|