- Added float, double settingentry types. Adjusted display formatting.
- Added menu refresh on Apply button. - Fixed package name resolution for invalid chars. - Added helper console command to get xml-safe name for use in localization files. - Made error messages for bad settings xml more descriptive. - Modified GUISlider. - Converted HarmonyEventPatchesService to a System. - Fixed package name resolution for incompatible names in Xml and files, in many places. - Fixed base textbox implementation for settings.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.LuaCs.Data;
|
||||
using Microsoft.Toolkit.Diagnostics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using OneOf;
|
||||
|
||||
namespace Barotrauma.LuaCs.Data;
|
||||
@@ -44,6 +46,19 @@ public class SettingRangeFloat : SettingRangeBase<float>
|
||||
}
|
||||
return base.TrySetValue(value);
|
||||
}
|
||||
|
||||
#if CLIENT
|
||||
public override void AddDisplayComponent(GUILayoutGroup layoutGroup, Vector2 relativeSize, Action<string> onSerializedValue)
|
||||
{
|
||||
GUIUtil.Slider(layoutGroup, new Vector2(MinValue, MaxValue), IncrementalSteps, labelFunc: val =>
|
||||
{
|
||||
return val.ToString("G4", CultureInfo.InvariantCulture);
|
||||
}, Value, setter: val =>
|
||||
{
|
||||
onSerializedValue?.Invoke(val.ToString());
|
||||
}, TextManager.Get(this.GetDisplayInfo().Tooltip), relativeSize);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public class SettingRangeInt : SettingRangeBase<int>
|
||||
@@ -73,4 +88,17 @@ public class SettingRangeInt : SettingRangeBase<int>
|
||||
}
|
||||
return base.TrySetValue(value);
|
||||
}
|
||||
|
||||
#if CLIENT
|
||||
public override void AddDisplayComponent(GUILayoutGroup layoutGroup, Vector2 relativeSize, Action<string> onSerializedValue)
|
||||
{
|
||||
GUIUtil.Slider(layoutGroup, new Vector2(MinValue, MaxValue), IncrementalSteps, labelFunc: val =>
|
||||
{
|
||||
return ((int)val).ToString();
|
||||
}, Value, setter: val =>
|
||||
{
|
||||
onSerializedValue?.Invoke(((int)val).ToString());
|
||||
}, TextManager.Get(this.GetDisplayInfo().Tooltip), relativeSize);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user