Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c6275a0
wip: rewrite SettingsWindow to be an actual window instead of an Imag…
pandinocoder Feb 2, 2025
893e761
more progress on settings menu, panel component, fixes for tables, sl…
pandinocoder Feb 4, 2025
f58bcb3
scroll control improvements and fixes
pandinocoder Feb 4, 2025
18c0ab5
settings window work, LabeledSlider, LabeledComboBox, TextboxNumeric …
pandinocoder Feb 4, 2025
643579e
LabeledComboBox passthrough events/properties
pandinocoder Feb 7, 2025
2e8f6e0
update the sender of ItemSelected
pandinocoder Feb 7, 2025
3dec2c3
fix scrollbar layout thrashing
pandinocoder Feb 5, 2025
ecf98ff
fix: get rid of layout thrashing when label isn't autosizing to conte…
pandinocoder Feb 5, 2025
aa7c67e
improve JSON serialization of UI props
pandinocoder Feb 5, 2025
b8ad1c8
serialize named table items
pandinocoder Feb 5, 2025
a08f60d
more named rows in DebugWindow
pandinocoder Feb 5, 2025
2d62e9c
more fixes and settings window work
pandinocoder Feb 7, 2025
10f1101
draggers are busted but click state is all correct
pandinocoder Feb 6, 2025
a27fbf4
alignment in labeled checkboxes is somehow busted
pandinocoder Feb 6, 2025
a1a2862
Add CenterV to LabeledCheckbox's Label Dock
pandinocoder Feb 7, 2025
bb9a517
Button constructor cleanup
pandinocoder Feb 7, 2025
f1b2209
temporary debugging code to figure out why text is sometimes going bl…
pandinocoder Feb 7, 2025
60b8403
fix: disablement/dragger/scrollbar fixes
pandinocoder Feb 7, 2025
34190be
event cleanup
pandinocoder Feb 7, 2025
3a92a7a
fix slider label/value position
pandinocoder Feb 7, 2025
c105b09
fix: make settings menu only block input when changing controls
pandinocoder Feb 7, 2025
4965b7b
fix: cursor position and caret color
pandinocoder Feb 7, 2025
2534a22
LogTrace for updating hovered component
pandinocoder Feb 7, 2025
55ce063
LoginWindow fixes
pandinocoder Feb 7, 2025
8912946
tooltip padding fix
pandinocoder Feb 7, 2025
4f67379
made the slider dragger more visible
pandinocoder Feb 7, 2025
3399a3a
combobox fixes
pandinocoder Feb 7, 2025
8a8dd00
spacing fix in titlebar
pandinocoder Feb 7, 2025
1399b70
fix resizing issue
pandinocoder Feb 7, 2025
08905e6
fix table scroll bounds
pandinocoder Feb 7, 2025
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
36 changes: 36 additions & 0 deletions Framework/Intersect.Framework/Serialization/JObjectExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Newtonsoft.Json.Linq;

namespace Intersect.Framework.Serialization;

public static class JObjectExtensions
{
public static bool TryGet<TEnum>(this JObject @object, string propertyName, out TEnum propertyValue)
where TEnum : struct, Enum =>
TryGet(@object, propertyName, default, out propertyValue);

public static bool TryGet<TEnum>(this JObject @object, string propertyName, TEnum defaultValue, out TEnum propertyValue)
where TEnum : struct, Enum
{
if ([email protected](propertyName, out var token))
{
propertyValue = defaultValue;
return false;
}

if (token is not JValue { Type: JTokenType.String } value)
{
propertyValue = defaultValue;
return false;
}

var rawEnum = value.Value<string>();
if (Enum.TryParse(rawEnum, out propertyValue))
{
return true;
}

propertyValue = defaultValue;
return false;

}
}
36 changes: 17 additions & 19 deletions Intersect.Client.Core/Core/Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ public static void OnKeyPressed(Keys modifier, Keys key)
return;

case Keys.Enter:

for (int i = Interface.Interface.InputBlockingElements.Count - 1; i >= 0; i--)
for (int i = Interface.Interface.InputBlockingComponents.Count - 1; i >= 0; i--)
{
var inputBlockingComponent = Interface.Interface.InputBlockingComponents[i];
try
{
if (Interface.Interface.InputBlockingElements[i] is InputBox inputBox && !inputBox.IsHidden)
if (inputBlockingComponent is InputBox { IsHidden: false } inputBox)
{
inputBox.SubmitInput();
canFocusChat = false;
Expand All @@ -98,8 +98,7 @@ public static void OnKeyPressed(Keys modifier, Keys key)

try
{
var eventWindow = (EventWindow)Interface.Interface.InputBlockingElements[i];
if (eventWindow != null && !eventWindow.IsHidden && Globals.EventDialogs.Count > 0)
if (inputBlockingComponent is EventWindow { IsHidden: false } eventWindow && Globals.EventDialogs.Count > 0)
{
eventWindow.CloseEventResponse(EventResponseType.OneOption);
canFocusChat = false;
Expand All @@ -109,7 +108,6 @@ public static void OnKeyPressed(Keys modifier, Keys key)
}
catch { }
}

break;
}

Expand Down Expand Up @@ -358,30 +356,30 @@ public static void OnKeyReleased(Keys modifier, Keys key)
}
}

public static void OnMouseDown(Keys modifier, MouseButtons btn)
public static void OnMouseDown(Keys modifier, MouseButton btn)
{
var key = Keys.None;
switch (btn)
{
case MouseButtons.Left:
case MouseButton.Left:
key = Keys.LButton;

break;

case MouseButtons.Right:
case MouseButton.Right:
key = Keys.RButton;

break;

case MouseButtons.Middle:
case MouseButton.Middle:
key = Keys.MButton;

break;
case MouseButtons.X1:
case MouseButton.X1:
key = Keys.XButton1;

break;
case MouseButtons.X2:
case MouseButton.X2:
key = Keys.XButton2;

break;
Expand All @@ -408,7 +406,7 @@ public static void OnMouseDown(Keys modifier, MouseButtons btn)
return;
}

if (modifier == Keys.None && btn == MouseButtons.Left && Globals.Me.TryTarget())
if (modifier == Keys.None && btn == MouseButton.Left && Globals.Me.TryTarget())
{
return;
}
Expand Down Expand Up @@ -442,25 +440,25 @@ public static void OnMouseDown(Keys modifier, MouseButtons btn)
}
}

public static void OnMouseUp(Keys modifier, MouseButtons btn)
public static void OnMouseUp(Keys modifier, MouseButton btn)
{
var key = Keys.LButton;
switch (btn)
{
case MouseButtons.Right:
case MouseButton.Right:
key = Keys.RButton;

break;

case MouseButtons.Middle:
case MouseButton.Middle:
key = Keys.MButton;

break;
case MouseButtons.X1:
case MouseButton.X1:
key = Keys.XButton1;

break;
case MouseButtons.X2:
case MouseButton.X2:
key = Keys.XButton2;

break;
Expand All @@ -487,7 +485,7 @@ public static void OnMouseUp(Keys modifier, MouseButtons btn)
return;
}

if (btn != MouseButtons.Right)
if (btn != MouseButton.Right)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Intersect.Client.Core/Entities/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ private void AutoTurnToTarget(Entity en)

private static void ToggleTargetContextMenu(Entity en)
{
if (Globals.InputManager.MouseButtonDown(MouseButtons.Right))
if (Globals.InputManager.MouseButtonDown(MouseButton.Right))
{
Interface.Interface.GameUi.TargetContextMenu.ToggleHidden(en);
}
Expand Down
Loading
Loading