Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Intersect.Client.Core/Interface/Shared/SettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ public SettingsWindow(Base parent) : base(parent: parent, title: Strings.Setting
_worldScale = new LabeledSlider(parent: _videoContainer, name: nameof(_worldScale))
{
Dock = Pos.Top,
IsDisabled = !Options.IsLoaded,
Font = _defaultFont,
Label = Strings.Settings.WorldScale,
Orientation = Orientation.LeftToRight,
Expand Down Expand Up @@ -556,6 +555,13 @@ protected override void EnsureInitialized()
LoadJsonUi(stage: UI.Shared, resolution: Graphics.Renderer?.GetResolutionString());
}

protected override void OnJsonReloaded()
{
base.OnJsonReloaded();

UpdateWorldScaleControls();
}

public override bool IsBlockingInput => _keybindingEditBtn is not null;

private BottomBarItems CreateBottomBar(Base parent)
Expand Down
17 changes: 13 additions & 4 deletions Intersect.Client.Framework/Gwen/Control/Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,12 @@ public object? UserData
public bool IsDisabled
{
get => (_inheritParentEnablementProperties && Parent != default) ? Parent.IsDisabled : _disabled;
set => SetAndDoIfChanged(ref _disabled, value, Invalidate);
set => SetAndDoIfChanged(ref _disabled, value, OnDisabledChanged);
}

protected virtual void OnDisabledChanged(bool oldValue, bool newValue)
{
Invalidate();
}

/// <summary>
Expand Down Expand Up @@ -1293,6 +1298,7 @@ public void LoadJsonUi(GameContentManager.UI stage, string? resolution = default
{
LoadJson(obj, true);
ProcessAlignments();
OnJsonReloaded();
}
}
catch (Exception exception)
Expand All @@ -1309,6 +1315,11 @@ public void LoadJsonUi(GameContentManager.UI stage, string? resolution = default
});
}

protected virtual void OnJsonReloaded()
{

}

public virtual void LoadJson(JToken token, bool isRoot = default)
{
if (token is not JObject obj)
Expand Down Expand Up @@ -4549,6 +4560,4 @@ protected bool SetAndDoIfChanged(
valueChangeHandler(oldValue, value);
return true;
}
}

public delegate void ValueChangeHandler<TValue>(TValue oldValue, TValue newValue);
}
5 changes: 5 additions & 0 deletions Intersect.Client.Framework/Gwen/Control/LabeledSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ public string? ValueFormatString
/// </summary>
public event GwenEventHandler<ValueChangedEventArgs<double>>? ValueChanged;

protected override void OnDisabledChanged(bool oldValue, bool newValue)
{
base.OnDisabledChanged(oldValue, newValue);
}

protected override void Layout(Skin.Base skin)
{
if (_recomputeValueMinimumSize)
Expand Down
3 changes: 3 additions & 0 deletions Intersect.Client.Framework/Gwen/Control/ValueChangeHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace Intersect.Client.Framework.Gwen.Control;

public delegate void ValueChangeHandler<TValue>(TValue oldValue, TValue newValue);
Loading