Improve tooltips for tri-state toggles.

This commit is contained in:
Ottermandias 2023-09-26 23:17:38 +02:00
parent 64ab57b2ef
commit ee34f37446
4 changed files with 7 additions and 15 deletions

View file

@ -153,10 +153,7 @@ public partial class CustomizationDrawer
var tmp = _currentByte != CustomizeValue.Zero;
if (_withApply)
{
switch (UiHelpers.DrawMetaToggle(_currentIndex.ToDefaultName(),
$"This attribute will be {(_currentApply ? tmp ? "enabled." : "disabled." : "kept as is.")}", tmp, _currentApply,
out var newValue,
out var newApply, _locked))
switch (UiHelpers.DrawMetaToggle(_currentIndex.ToDefaultName(), tmp, _currentApply, out var newValue, out var newApply, _locked))
{
case DataChange.Item:
_customize.Set(idx, newValue ? CustomizeValue.Max : CustomizeValue.Zero);

View file

@ -128,8 +128,7 @@ public partial class CustomizationDrawer : IDisposable
=> UiHelpers.DrawCheckbox("Force Wetness", "Force the character to be wet or not.", currentValue, out newValue, locked);
public DataChange DrawWetnessState(bool currentValue, bool currentApply, out bool newValue, out bool newApply, bool locked)
=> UiHelpers.DrawMetaToggle("Force Wetness", "Change the characters forced wetness state: Disabled, Enabled or Don't Apply.",
currentValue, currentApply, out newValue, out newApply, locked);
=> UiHelpers.DrawMetaToggle("Force Wetness", currentValue, currentApply, out newValue, out newApply, locked);
private bool DrawInternal()
{

View file

@ -161,23 +161,19 @@ public class EquipmentDrawer
=> UiHelpers.DrawCheckbox("Hat Visible", "Hide or show the characters head gear.", currentValue, out newValue, locked);
public static DataChange DrawHatState(bool currentValue, bool currentApply, out bool newValue, out bool newApply, bool locked)
=> UiHelpers.DrawMetaToggle("Hat Visible", "Change the visibility of the characters head gear: Hidden, Visible or Don't Apply.",
currentValue, currentApply, out newValue, out newApply, locked);
=> UiHelpers.DrawMetaToggle("Hat Visible", currentValue, currentApply, out newValue, out newApply, locked);
public static bool DrawVisorState(bool currentValue, out bool newValue, bool locked)
=> UiHelpers.DrawCheckbox("Visor Toggled", "Toggle the visor state of the characters head gear.", currentValue, out newValue, locked);
public static DataChange DrawVisorState(bool currentValue, bool currentApply, out bool newValue, out bool newApply, bool locked)
=> UiHelpers.DrawMetaToggle("Visor Toggled", "Change the toggled state of the characters head gear: Normal, Toggled or Don't Apply.",
currentValue, currentApply, out newValue, out newApply, locked);
=> UiHelpers.DrawMetaToggle("Visor Toggled", currentValue, currentApply, out newValue, out newApply, locked);
public static bool DrawWeaponState(bool currentValue, out bool newValue, bool locked)
=> UiHelpers.DrawCheckbox("Weapon Visible", "Hide or show the characters weapons when not drawn.", currentValue, out newValue, locked);
public static DataChange DrawWeaponState(bool currentValue, bool currentApply, out bool newValue, out bool newApply, bool locked)
=> UiHelpers.DrawMetaToggle("Weapon Visible",
"Change the visibility of the characters weapons when not drawn: Hidden, Visible or Don't Apply.", currentValue, currentApply,
out newValue, out newApply, locked);
=> UiHelpers.DrawMetaToggle("Weapon Visible", currentValue, currentApply, out newValue, out newApply, locked);
private bool DrawMainhand(EquipItem current, bool drawAll, out EquipItem weapon, out string label, bool locked, bool small, bool open)
{

View file

@ -66,7 +66,7 @@ public static class UiHelpers
return ret;
}
public static DataChange DrawMetaToggle(string label, string tooltip, bool currentValue, bool currentApply, out bool newValue,
public static DataChange DrawMetaToggle(string label, bool currentValue, bool currentApply, out bool newValue,
out bool newApply,
bool locked)
{
@ -78,7 +78,7 @@ public static class UiHelpers
ret = ImGui.CheckboxFlags("##" + label, ref flags, 3);
}
ImGuiUtil.HoverTooltip(tooltip);
ImGuiUtil.HoverTooltip($"This attribute will be {(currentApply ? currentValue ? "enabled." : "disabled." : "kept as is.")}");
ImGui.SameLine();
ImGui.TextUnformatted(label);