SHADE_Y3/Assets/Scripts/UI/SC_SliderText.cs

40 lines
949 B
C#
Raw Normal View History

2023-02-27 09:55:54 +08:00
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class SliderText:Script
{
public GameObject sliderObj;
2023-02-27 16:39:31 +08:00
protected override void start()
{
Slider slider = sliderObj.GetComponent<Slider>();
TextRenderable text = GetComponent<TextRenderable>();
if (slider != null && text != null)
{
2023-02-27 09:55:54 +08:00
2023-03-07 10:08:30 +08:00
text.Text = ((int)(slider.ScaledValue)).ToString();
2023-02-27 16:39:31 +08:00
}
}
2023-02-27 09:55:54 +08:00
protected override void update()
{
Slider slider = sliderObj.GetComponent<Slider>();
TextRenderable text = GetComponent<TextRenderable>();
if(slider != null && text != null)
{
2023-02-27 10:28:20 +08:00
2023-03-07 10:08:30 +08:00
text.Text = ((int)(slider.ScaledValue)).ToString();
2023-02-27 09:55:54 +08:00
}
}
}
}