2026-02-09 20:28:09 +09:00
|
|
|
#nullable enable
|
|
|
|
|
using System;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace UVC.UIToolkit
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 버튼 속성 Item 클래스입니다.
|
|
|
|
|
/// UTKButton 설정을 포함하며, 클릭 시 Action 이름을 전달합니다.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class UTKButtonItem : UTKPropertyItemBase<string>
|
|
|
|
|
{
|
|
|
|
|
#region Properties
|
|
|
|
|
public override UTKPropertyType PropertyType => UTKPropertyType.Button;
|
|
|
|
|
|
|
|
|
|
/// <summary>버튼 텍스트</summary>
|
|
|
|
|
public string Text { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>버튼 아이콘</summary>
|
|
|
|
|
public string Icon { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>아이콘 크기</summary>
|
|
|
|
|
public int IconSize { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>버튼 스타일 변형</summary>
|
|
|
|
|
public UTKButton.ButtonVariant Variant { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>버튼 크기</summary>
|
|
|
|
|
public UTKButton.ButtonSize Size { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>커스텀 배경 색상</summary>
|
|
|
|
|
public Color? BackgroundColor { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>외곽선 굵기</summary>
|
|
|
|
|
public int BorderWidth { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>아이콘만 표시 모드</summary>
|
|
|
|
|
public bool IconOnly { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>액션 이름 (버튼 클릭 시 전달되는 고유 이름)</summary>
|
|
|
|
|
public string ActionName { get; }
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Constructor
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 기본 버튼 아이템을 생성합니다.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">고유 ID</param>
|
|
|
|
|
/// <param name="actionName">액션 이름 (클릭 시 전달)</param>
|
|
|
|
|
/// <param name="text">버튼 텍스트</param>
|
|
|
|
|
/// <param name="icon">버튼 아이콘</param>
|
|
|
|
|
/// <param name="variant">버튼 스타일</param>
|
|
|
|
|
/// <param name="size">버튼 크기</param>
|
|
|
|
|
public UTKButtonItem(
|
|
|
|
|
string id,
|
|
|
|
|
string actionName,
|
|
|
|
|
string text = "",
|
|
|
|
|
string icon = "",
|
|
|
|
|
UTKButton.ButtonVariant variant = UTKButton.ButtonVariant.Normal,
|
|
|
|
|
UTKButton.ButtonSize size = UTKButton.ButtonSize.Medium)
|
|
|
|
|
: base(id, actionName, actionName)
|
|
|
|
|
{
|
|
|
|
|
ActionName = actionName;
|
|
|
|
|
Text = text;
|
|
|
|
|
Icon = icon;
|
|
|
|
|
IconSize = 12;
|
|
|
|
|
Variant = variant;
|
|
|
|
|
Size = size;
|
|
|
|
|
BackgroundColor = null;
|
|
|
|
|
BorderWidth = -1;
|
|
|
|
|
IconOnly = false;
|
2026-02-10 20:48:49 +09:00
|
|
|
_showLabel = true; // 기본적으로 라벨 표시
|
2026-02-09 20:28:09 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 전체 설정을 포함한 버튼 아이템을 생성합니다.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">고유 ID</param>
|
|
|
|
|
/// <param name="actionName">액션 이름</param>
|
|
|
|
|
/// <param name="text">버튼 텍스트</param>
|
|
|
|
|
/// <param name="icon">버튼 아이콘</param>
|
|
|
|
|
/// <param name="iconSize">아이콘 크기</param>
|
|
|
|
|
/// <param name="variant">버튼 스타일</param>
|
|
|
|
|
/// <param name="size">버튼 크기</param>
|
|
|
|
|
/// <param name="backgroundColor">배경 색상</param>
|
|
|
|
|
/// <param name="borderWidth">외곽선 굵기</param>
|
|
|
|
|
/// <param name="iconOnly">아이콘만 표시</param>
|
|
|
|
|
/// <param name="showLabel">라벨 표시 여부</param>
|
|
|
|
|
public UTKButtonItem(
|
|
|
|
|
string id,
|
|
|
|
|
string actionName,
|
|
|
|
|
string text,
|
|
|
|
|
string icon,
|
|
|
|
|
int iconSize,
|
|
|
|
|
UTKButton.ButtonVariant variant,
|
|
|
|
|
UTKButton.ButtonSize size,
|
|
|
|
|
Color? backgroundColor,
|
|
|
|
|
int borderWidth,
|
|
|
|
|
bool iconOnly,
|
|
|
|
|
bool showLabel = true)
|
|
|
|
|
: base(id, actionName, actionName)
|
|
|
|
|
{
|
|
|
|
|
ActionName = actionName;
|
|
|
|
|
Text = text;
|
|
|
|
|
Icon = icon;
|
|
|
|
|
IconSize = iconSize;
|
|
|
|
|
Variant = variant;
|
|
|
|
|
Size = size;
|
|
|
|
|
BackgroundColor = backgroundColor;
|
|
|
|
|
BorderWidth = borderWidth;
|
|
|
|
|
IconOnly = iconOnly;
|
2026-02-10 20:48:49 +09:00
|
|
|
_showLabel = showLabel;
|
2026-02-09 20:28:09 +09:00
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|