ProjectDDD/Assets/_DDD/_Scripts/GameUi/New/Utils/BindingHelper.cs
2025-08-21 16:25:27 +09:00

39 lines
1.5 KiB
C#

using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace DDD
{
public static class BindingHelper
{
public static void BindText(BindingContext context, TextMeshProUGUI text, string propertyPath, IValueConverter converter = null)
{
var target = new TextBindingTarget(text, propertyPath);
context?.Bind(propertyPath, target, converter);
}
public static void BindImage(BindingContext context, Image image, string propertyPath, IValueConverter converter = null)
{
var target = new ImageBindingTarget(image, propertyPath);
context?.Bind(propertyPath, target, converter);
}
public static void BindImageFilled(BindingContext context, Image image, string propertyPath, IValueConverter converter = null)
{
var target = new ImageFilledBindingTarget(image, propertyPath);
context?.Bind(propertyPath, target, converter);
}
public static void BindActive(BindingContext context, GameObject gameObject, string propertyPath, IValueConverter converter = null)
{
var target = new ActiveBindingTarget(gameObject, propertyPath);
context?.Bind(propertyPath, target, converter);
}
public static void BindSlider(BindingContext context, Slider slider, string propertyPath, IValueConverter converter = null)
{
var target = new SliderBindingTarget(slider, propertyPath);
context?.Bind(propertyPath, target, converter);
}
}
}