2026-04-22 모듈러 에셋 포함
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
// Magica Cloth 2.
|
||||
// Copyright (c) 2023 MagicaSoft.
|
||||
// https://magicasoft.jp
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace MagicaCloth2
|
||||
{
|
||||
public class SliderText : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Text text = null;
|
||||
|
||||
[SerializeField]
|
||||
private string lable = "";
|
||||
|
||||
[SerializeField]
|
||||
private string format = "0.00";
|
||||
|
||||
private string formatString;
|
||||
|
||||
protected void Start()
|
||||
{
|
||||
formatString = "{0} ({1:" + format + "})";
|
||||
|
||||
var slider = GetComponent<Slider>();
|
||||
if (slider)
|
||||
{
|
||||
slider.onValueChanged.AddListener(OnChangeValue);
|
||||
|
||||
var val = slider.value;
|
||||
slider.value = 0.001f;
|
||||
slider.value = val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnChangeValue(float value)
|
||||
{
|
||||
if (text)
|
||||
{
|
||||
text.text = string.Format(formatString, lable, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user