42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
|
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;
|
|||
|
|
|||
|
public int minValue = 0;
|
|||
|
public int maxValue = 0;
|
|||
|
|
|||
|
protected override void start()
|
|||
|
{
|
|||
|
Slider slider = sliderObj.GetComponent<Slider>();
|
|||
|
TextRenderable text = GetComponent<TextRenderable>();
|
|||
|
|
|||
|
if (slider != null && text != null)
|
|||
|
{
|
|||
|
|
|||
|
text.Text = ((int)(slider.GetValue() * (maxValue - minValue) + minValue)).ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
protected override void update()
|
|||
|
{
|
|||
|
Slider slider = sliderObj.GetComponent<Slider>();
|
|||
|
TextRenderable text = GetComponent<TextRenderable>();
|
|||
|
if(slider != null && text != null)
|
|||
|
{
|
|||
|
|
|||
|
text.Text = ((int)(slider.GetValue() * (maxValue - minValue) + minValue)).ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|