ComponentList 개발 중
This commit is contained in:
@@ -55,6 +55,7 @@ namespace UVC.UI.Menu
|
||||
/// // 생성자: (itemId, displayName, command, commandParameter)
|
||||
/// new ContextMenuItemData("player_attack", "공격", new LogCommand(), "플레이어가 '공격'을 선택했습니다."),
|
||||
/// new ContextMenuItemData("player_talk", "대화", new LogCommand(), "플레이어가 '대화'를 선택했습니다."),
|
||||
/// new ContextMenuItemData(isSeparator: true), // 구분선 추가
|
||||
/// new ContextMenuItemData("player_inspect", "조사", new LogCommand(), "플레이어가 '조사'를 선택했습니다.")
|
||||
/// };
|
||||
///
|
||||
@@ -78,6 +79,10 @@ namespace UVC.UI.Menu
|
||||
[Tooltip("컨텍스트 메뉴의 각 항목으로 사용될 Button 프리팹입니다.")]
|
||||
private GameObject contextMenuItemPrefab;
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("컨텍스트 메뉴의 구분선으로 사용될 UI 프리팹입니다.")]
|
||||
private GameObject contextMenuSeparatorPrefab;
|
||||
|
||||
[Header("캔버스 설정")]
|
||||
[SerializeField]
|
||||
[Tooltip("UI가 그려질 최상위 Canvas입니다. 메뉴가 다른 UI 위에 그려지도록 합니다.")]
|
||||
@@ -170,6 +175,16 @@ namespace UVC.UI.Menu
|
||||
{
|
||||
foreach (var itemData in items)
|
||||
{
|
||||
if (itemData.IsSeparator)
|
||||
{
|
||||
// 이 항목이 구분선인 경우, 구분선 프리팹을 인스턴스화합니다.
|
||||
if (contextMenuSeparatorPrefab != null)
|
||||
{
|
||||
Instantiate(contextMenuSeparatorPrefab, _activeMenuRect);
|
||||
}
|
||||
continue; // 다음 항목으로 넘어갑니다.
|
||||
}
|
||||
|
||||
// 풀에서 메뉴 항목 버튼을 가져옵니다.
|
||||
Button menuItemButton = _menuItemPool.GetItem(true, _activeMenuRect);
|
||||
|
||||
@@ -194,7 +209,7 @@ namespace UVC.UI.Menu
|
||||
{
|
||||
// 항목을 클릭하면 메뉴를 닫고, 설정된 액션을 실행합니다.
|
||||
HideMenu();
|
||||
itemData.Command.Execute(itemData.CommandParameter);
|
||||
itemData.Command?.Execute(itemData.CommandParameter);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user