94 lines
3.3 KiB
C#
94 lines
3.3 KiB
C#
#nullable enable
|
|
|
|
using System.Collections.Generic;
|
|
using UVC.UI.Commands;
|
|
|
|
namespace UVC.UIToolkit
|
|
{
|
|
/// <summary>
|
|
/// 이미지 아이콘을 사용하는 메뉴 아이템 데이터 클래스입니다.
|
|
/// UTKMenuItemData를 상속받아 이미지 경로 정보를 추가합니다.
|
|
/// </summary>
|
|
/// <example>
|
|
/// <code>
|
|
/// // 이미지 메뉴 아이템 생성
|
|
/// var imageItem = new UTKMenuImageItemData(
|
|
/// "settings",
|
|
/// "Settings/gear", // 이미지 경로
|
|
/// new OpenSettingsCommand()
|
|
/// );
|
|
///
|
|
/// // Material Icon 사용
|
|
/// var iconItem = new UTKMenuImageItemData(
|
|
/// "home",
|
|
/// UTKMaterialIcons.Home, // Material Icon
|
|
/// new NavigateHomeCommand()
|
|
/// );
|
|
/// </code>
|
|
/// </example>
|
|
public class UTKMenuImageItemData : UTKMenuItemData
|
|
{
|
|
#region Properties
|
|
|
|
/// <summary>
|
|
/// 이미지 경로 또는 Material Icon 문자 (Unicode).
|
|
/// Resources 폴더 기준 경로 또는 Material Icon 유니코드 문자열.
|
|
/// </summary>
|
|
public string ImagePath { get; set; }
|
|
|
|
/// <summary>
|
|
/// Material Icon 사용 여부.
|
|
/// true면 ImagePath를 Material Icon Unicode로 처리합니다.
|
|
/// </summary>
|
|
public bool UseMaterialIcon { get; set; }
|
|
|
|
/// <summary>
|
|
/// 이미지 크기 (픽셀). 기본값: 20.
|
|
/// </summary>
|
|
public float ImageSize { get; set; } = 20f;
|
|
|
|
/// <summary>
|
|
/// 이미지 색상. null이면 기본 색상 사용.
|
|
/// </summary>
|
|
public UnityEngine.Color? ImageColor { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
/// <summary>
|
|
/// UTKMenuImageItemData의 새 인스턴스를 초기화합니다.
|
|
/// </summary>
|
|
/// <param name="itemId">메뉴 아이템의 고유 ID</param>
|
|
/// <param name="imagePath">이미지 경로 또는 Material Icon</param>
|
|
/// <param name="command">실행할 명령 (선택 사항)</param>
|
|
/// <param name="commandParameter">Command 파라미터 (선택 사항)</param>
|
|
/// <param name="subMenuItems">하위 메뉴 아이템 목록 (선택 사항)</param>
|
|
/// <param name="isEnabled">활성화 상태 (기본값: true)</param>
|
|
/// <param name="shortcut">단축키 문자열 (선택 사항)</param>
|
|
/// <param name="useMaterialIcon">Material Icon 사용 여부 (기본값: false)</param>
|
|
/// <param name="imageSize">이미지 크기 (기본값: 20)</param>
|
|
/// <param name="imageColor">이미지 색상 (선택 사항)</param>
|
|
public UTKMenuImageItemData(
|
|
string itemId,
|
|
string imagePath,
|
|
ICommand? command = null,
|
|
object? commandParameter = null,
|
|
List<UTKMenuItemData>? subMenuItems = null,
|
|
bool isEnabled = true,
|
|
string? shortcut = null,
|
|
bool useMaterialIcon = false,
|
|
float imageSize = 20f,
|
|
UnityEngine.Color? imageColor = null)
|
|
: base(itemId, imagePath, command, commandParameter, subMenuItems, false, isEnabled, shortcut)
|
|
{
|
|
ImagePath = imagePath;
|
|
UseMaterialIcon = useMaterialIcon;
|
|
ImageSize = imageSize;
|
|
ImageColor = imageColor;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|