toolbar 개발 중

This commit is contained in:
logonkhi
2025-06-16 19:30:01 +09:00
parent 2ffe7abac6
commit 63b71216cb
92 changed files with 5915 additions and 530 deletions

View File

@@ -54,12 +54,12 @@ namespace UVC.UI.Modal
/// ✨ 지정된 제목과 메시지로 확인창을 화면에 뿅! 하고 보여줘요.
/// 사용자가 "확인" 또는 "취소" 버튼을 누를 때까지 코드는 여기서 잠시 멈춰 기다려요.
/// </summary>
/// <param name="title">확인창 맨 위에 크게 보일 '제목'이에요.</param>
/// <param name="message">확인창에 보여줄 '질문 또는 메시지 내용'이에요.</param>
/// <param name="confirmButtonText">"확인" 버튼에 보여줄 글자예요. 안 적으면 기본 글자("확인")가 나와요.</param>
/// <param name="cancelButtonText">"취소" 버튼에 보여줄 글자예요. 안 적으면 기본 글자("취소")가 나와요.</param>
/// <param name="customPrefabPath">특별히 만들어둔 확인창 디자인 파일 경로예요. 없으면 기본 디자인을 사용해요.</param>
/// <returns>사용자가 "확인"을 누르면 true, "취소"를 누르면 false를 돌려주는 작업(UniTask&lt;bool&gt;)이에요.</returns>
/// <param name="title">확인창 맨 위에 크게 보일 '제목'이에요. 다국어 키도 가능해요.</param>
/// <param name="message">확인창에 보여줄 '질문 또는 메시지 내용'이에요. 다국어 키도 가능해요.</param>
/// <param name="confirmButtonText">"확인" 버튼에 보여줄 글자예요. 안 적으면 기본 글자("확인")가 나와요. 다국어 키도 가능해요.</param>
/// <param name="cancelButtonText">"취소" 버튼에 보여줄 글자예요. 안 적으면 기본 글자("취소")가 나와요. 다국어 키도 가능해요.</param>
/// <param name="customPrefabPath">특별히 만들어둔 확인창 디자인 파일 경로예요. 없으면 기본 디자인을 사용해요. 다국어 키도 가능해요.</param>
/// <returns>사용자가 "확인"을 누르면 true, "취소"를 누르면 false를 돌려주는 작업(UniTask<bool>)이에요.</returns>
/// <example>
/// <code>
/// public class ShopManager : MonoBehaviour
@@ -80,60 +80,7 @@ namespace UVC.UI.Modal
/// {
/// ULog.Debug($"{itemName} 구매를 취소했습니다.");
/// }
/// }
/// }
/// </code>
/// </example>
public static async UniTask<bool> Show(
string title,
string message,
string confirmButtonText = null,
string cancelButtonText = null,
string customPrefabPath = null)
{
string prefabPath = string.IsNullOrEmpty(customPrefabPath) ? DefaultPrefabPath : customPrefabPath;
// ModalContent 레시피를 만들어요. 확인창은 확인/취소 버튼이 모두 필요해요.
ModalContent content = new ModalContent(prefabPath)
{
Title = title,
Message = message,
ShowConfirmButton = true, // Confirm에서는 확인 버튼 항상 표시
ShowCancelButton = true // Confirm에서는 취소 버튼 항상 표시
};
// 확인 버튼 글자를 따로 정해줬다면 그걸로 설정해요.
if (!string.IsNullOrEmpty(confirmButtonText))
{
content.ConfirmButtonText = confirmButtonText;
}
// 취소 버튼 글자를 따로 정해줬다면 그걸로 설정해요.
if (!string.IsNullOrEmpty(cancelButtonText))
{
content.CancelButtonText = cancelButtonText;
}
// Modal 시스템에게 "이 레시피대로 모달 창 열어줘!" 라고 부탁하고, 사용자의 선택(true/false)을 기다려요.
return await Modal.Open<bool>(content);
}
/// <summary>
/// 🌍 다국어(여러 나라 언어)를 지원하는 확인창을 보여줘요.
/// 미리 준비된 '언어 키'를 알려주면, 게임 설정 언어에 맞는 글자를 자동으로 찾아서 보여줘요.
/// </summary>
/// <param name="titleLocalizationKey">제목에 사용할 '언어 키'예요. (예: "confirm_title_exit_game")</param>
/// <param name="messageLocalizationKey">메시지 내용에 사용할 '언어 키'예요. (예: "confirm_message_are_you_sure")</param>
/// <param name="confirmButtonLocalizationKey">확인 버튼 글자에 사용할 '언어 키'예요. 안 적으면 기본 키("button_confirm")를 사용해요.</param>
/// <param name="cancelButtonLocalizationKey">취소 버튼 글자에 사용할 '언어 키'예요. 안 적으면 기본 키("button_cancel")를 사용해요.</param>
/// <param name="customPrefabPath">특별한 확인창 디자인 파일 경로예요. 없으면 기본 디자인을 사용해요.</param>
/// <returns>사용자가 "확인"을 누르면 true, "취소"를 누르면 false를 돌려주는 작업(UniTask&lt;bool&gt;)이에요.</returns>
/// <example>
/// <code>
/// public class SettingsManager : MonoBehaviour
/// {
/// public async void OnResetSettings()
/// {
///
/// // 예시: 설정 초기화 전에 다국어로 확인을 받습니다.
/// // titleLocalizationKey: "settings_reset_title" -> "설정 초기화" (한국어), "Reset Settings" (영어)
/// // messageLocalizationKey: "settings_reset_confirm_message" -> "모든 설정을 초기화하시겠습니까?" (한국어), "Are you sure you want to reset all settings?" (영어)
@@ -154,35 +101,43 @@ namespace UVC.UI.Modal
/// {
/// ULog.Debug("설정 초기화를 취소했습니다.");
/// }
///
/// }
/// }
/// </code>
/// </example>
public static async UniTask<bool> ShowLocalized(
string titleLocalizationKey,
string messageLocalizationKey,
string confirmButtonLocalizationKey = null,
string cancelButtonLocalizationKey = null,
public static async UniTask<bool> Show(
string title,
string message,
string confirmButtonText = null,
string cancelButtonText = null,
string customPrefabPath = null)
{
// 언어 키를 사용해서 실제 보여줄 글자들을 가져와요.
string title = LocalizationManager.Instance.GetString(titleLocalizationKey);
string message = LocalizationManager.Instance.GetString(messageLocalizationKey);
string confirmText = null;
string cancelText = null;
string prefabPath = string.IsNullOrEmpty(customPrefabPath) ? DefaultPrefabPath : customPrefabPath;
if (!string.IsNullOrEmpty(confirmButtonLocalizationKey))
// ModalContent 레시피를 만들어요. 확인창은 확인/취소 버튼이 모두 필요해요.
ModalContent content = new ModalContent(prefabPath)
{
confirmText = LocalizationManager.Instance.GetString(confirmButtonLocalizationKey);
Title = LocalizationManager.Instance.GetString(title),
Message = LocalizationManager.Instance.GetString(message),
ShowConfirmButton = true, // Confirm에서는 확인 버튼 항상 표시
ShowCancelButton = true // Confirm에서는 취소 버튼 항상 표시
};
// 확인 버튼 글자를 따로 정해줬다면 그걸로 설정해요.
if (!string.IsNullOrEmpty(confirmButtonText))
{
content.ConfirmButtonText = LocalizationManager.Instance.GetString(confirmButtonText);
}
if (!string.IsNullOrEmpty(cancelButtonLocalizationKey))
// 취소 버튼 글자를 따로 정해줬다면 그걸로 설정해요.
if (!string.IsNullOrEmpty(cancelButtonText))
{
cancelText = LocalizationManager.Instance.GetString(cancelButtonLocalizationKey);
content.CancelButtonText = LocalizationManager.Instance.GetString(cancelButtonText);
}
// 준비된 글자들로 확인창을 보여달라고 Show()에게 다시 부탁하고, 사용자의 선택을 기다려요.
return await Show(title, message, confirmText, cancelText, customPrefabPath);
// Modal 시스템에게 "이 레시피대로 모달 창 열어줘!" 라고 부탁하고, 사용자의 선택(true/false)을 기다려요.
return await Modal.Open<bool>(content);
}
}
}