Rename source folder

This commit is contained in:
amevarashi 2022-09-08 19:59:25 +05:00
parent 0a412a0060
commit a4c046a841
55 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,36 @@
using UnityEngine;
using Verse;
namespace RJWSexperience.Settings
{
public static class SettingsWidgets
{
public const float lineHeight = 24f;
public static void LabelwithTextfield(Rect rect, string label, string tooltip, ref float value, float min, float max)
{
Rect textfieldRect = new Rect(rect.xMax - 100f, rect.y, 100f, rect.height);
string valuestr = value.ToString();
Widgets.Label(rect, label);
Widgets.TextFieldNumeric(textfieldRect, ref value, ref valuestr, min, max);
Widgets.DrawHighlightIfMouseover(rect);
TooltipHandler.TipRegion(rect, tooltip);
}
public static void SliderOption(Rect doublerect, string label, string tooltip, ref float value, float min, float max, float roundTo)
{
// Slider was fighting with textfield for "correct" decimals. Causes a repeating slider move sound
float fieldValue = value;
float sliderValue = value;
float minChange = roundTo / 10f;
LabelwithTextfield(doublerect.TopHalf(), label, tooltip, ref fieldValue, min, max);
sliderValue = Widgets.HorizontalSlider(doublerect.BottomHalf(), sliderValue, min, max, roundTo: roundTo);
if (Mathf.Abs(fieldValue - value) > minChange)
value = fieldValue;
else
value = sliderValue;
}
}
}