Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional UI rewrites and bug fixes #2545

Merged
merged 30 commits into from
Feb 13, 2025
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
2cef371
fix #2528 #2529 Hotbar alignment and Credits scrollbar and alignment
lodicolo Feb 9, 2025
9539c8b
fix MainMenuWindow alignments
lodicolo Feb 9, 2025
ceb5fca
Switch to IsResizable
lodicolo Feb 9, 2025
fd443a8
prepare all windows for correct alignment
lodicolo Feb 9, 2025
a0c8511
main menu/login window alignment fixes
lodicolo Feb 9, 2025
47e6515
update button textures in skin
lodicolo Feb 9, 2025
3a2c33e
reformatting/cleanup
lodicolo Feb 9, 2025
5c837e6
normalization between windows, fixed registration window layout
lodicolo Feb 9, 2025
28e2e4d
RegistrationWindow LoadJsonUi
lodicolo Feb 9, 2025
44539df
move EnsuredInitialized to predraw, make error windows into alert win…
lodicolo Feb 9, 2025
9fabbc9
warnings, errors, information alerts
lodicolo Feb 10, 2025
7a95f4c
un-nest InputType
lodicolo Feb 10, 2025
dfe0ea5
rework on alignment, bounds positioning, etc to improve performance a…
lodicolo Feb 10, 2025
d46216a
more event window related fixes, disabling event window JSONs because…
lodicolo Feb 10, 2025
394cfee
Chatbox mostly fixed
lodicolo Feb 11, 2025
90633bb
partially working ViewClickedNodeInDebugger functionality
lodicolo Feb 11, 2025
d2b93ae
better tooltip positioning (so tooltips don't cover the text they're …
lodicolo Feb 11, 2025
149a312
Corrected column width basis to resolve initial chatbox sizing issues…
lodicolo Feb 11, 2025
e501e4d
fix and cleanup crafting window #2541
lodicolo Feb 11, 2025
bd5e37a
hotbar size fix
lodicolo Feb 11, 2025
1bdd6fb
rewrite AdminWindow, includes a fix for #2536
lodicolo Feb 11, 2025
bf31fcc
reenable saving Settings/InputBox
lodicolo Feb 12, 2025
7102658
performance fixes on DebugWindow
lodicolo Feb 12, 2025
f93e063
Redo layout of character selection window #2532
lodicolo Feb 12, 2025
ffac121
Correctly name the input slider component #2555
lodicolo Feb 12, 2025
48af167
Disable text in menu buttons #2556
lodicolo Feb 12, 2025
a2cab6f
Make sliders in LabeledSlider fill #2549
lodicolo Feb 12, 2025
2def5c5
Redo ingame menu #2547
lodicolo Feb 13, 2025
fef98c2
Rework menu positioning logic to make sure that the menu is on screen…
lodicolo Feb 13, 2025
cf96f9d
fix aspect ratio positioning #2557
lodicolo Feb 13, 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
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ resharper_csharp_wrap_before_invocation_rpar = true
resharper_csharp_wrap_parameters_style = chop_if_long
resharper_keep_existing_invocation_parens_arrangement = false
resharper_keep_existing_property_patterns_arrangement = false
resharper_max_initializer_elements_on_line = 2
resharper_max_invocation_arguments_on_line = 5
resharper_place_expr_property_on_single_line = true
resharper_place_simple_initializer_on_single_line = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public Guid FindFirstMap()

if (OrderedMaps.Count > 0)
{
lowestMap = OrderedMaps.OrderBy(m => m.TimeCreated).FirstOrDefault().MapId;
lowestMap = OrderedMaps.OrderBy(m => m.TimeCreated).FirstOrDefault()?.MapId ?? default;
}

return lowestMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ public partial class MapListMap : MapListItem, IComparable<MapListMap>

public long TimeCreated;

public MapListMap() : base()
public MapListMap()
{
Name = "New Map";
Type = 1;
}

public int CompareTo(MapListMap obj)
{
return Name.CompareTo(obj.Name);
}
public int CompareTo(MapListMap other) =>
string.Compare(Name, other.Name, StringComparison.CurrentCultureIgnoreCase);

public void PostLoad(DatabaseObjectLookup gameMaps, bool isServer = true)
{
Expand Down
34 changes: 34 additions & 0 deletions Framework/Intersect.Framework.Core/Models/DbList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.Diagnostics.CodeAnalysis;
using Intersect.Collections;

namespace Intersect.Models;

public partial class DbList<T> : List<Guid> where T : IDatabaseObject
{
public List<T> GetAll()
{
var list = new List<T>();
foreach (var l in ToArray())
{
list.Add((T)DatabaseObjectLookup.LookupMap[typeof(T)].Get(l));
}

return list;
}

public T Get(Guid id)
{
return (T)DatabaseObjectLookup.LookupMap[typeof(T)].Get(id);
}

public bool TryGet(Guid id, [NotNullWhen(true)] out T? value)
{
if (DatabaseObjectLookup.LookupMap.TryGetValue(typeof(T), out var lookupMap))
{
return lookupMap.TryGetValue<T>(id, out value);
}

value = default;
return false;
}
}
26 changes: 2 additions & 24 deletions Framework/Intersect.Framework.Core/Models/IDatabaseObject.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Intersect.Collections;
using Intersect.Enums;
using Intersect.Enums;
using Newtonsoft.Json;

namespace Intersect.Models;
Expand Down Expand Up @@ -27,25 +26,4 @@ public interface IDatabaseObject : INamedObject

void Delete();

}

public partial class DbList<T> : List<Guid>
{

public List<T> GetAll()
{
var list = new List<T>();
foreach (var l in ToArray())
{
list.Add((T) DatabaseObjectLookup.LookupMap[typeof(T)].Get(l));
}

return list;
}

public T Get(Guid id)
{
return (T) DatabaseObjectLookup.LookupMap[typeof(T)].Get(id);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public EventInputVariablePacket(Guid eventId, bool booleanValue, int value, stri
public bool BooleanValue { get; set; }

[Key(2)]
public string StringValue { get; set; }
public string? StringValue { get; set; }

[Key(3)]
public int Value { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions Intersect.Client.Core/Core/Graphics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ public static void DrawInGame(TimeSpan deltaTime)
}

//Game Rendering
public static void Render(TimeSpan deltaTime, TimeSpan _)
public static void Render(TimeSpan deltaTime, TimeSpan totalTime)
{
var takingScreenshot = false;
if (Renderer?.ScreenshotRequests.Count > 0)
Expand Down Expand Up @@ -592,7 +592,7 @@ public static void Render(TimeSpan deltaTime, TimeSpan _)

Renderer.Scale = Globals.Database.UIScale;

Interface.Interface.DrawGui();
Interface.Interface.DrawGui(deltaTime, totalTime);

DrawGameTexture(
Renderer.GetWhiteTexture(), new FloatRect(0, 0, 1, 1), CurrentView,
Expand Down
50 changes: 39 additions & 11 deletions Intersect.Client.Core/Core/Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

namespace Intersect.Client.Core;

public delegate bool MouseButtonEventInterceptor(Keys modifier, MouseButton mouseButton);

public static partial class Input
{
public delegate void HandleKeyEvent(Keys modifier, Keys key);
Expand Down Expand Up @@ -82,9 +84,10 @@ public static void OnKeyPressed(Keys modifier, Keys key)
return;

case Keys.Enter:
for (int i = Interface.Interface.InputBlockingComponents.Count - 1; i >= 0; i--)
var components = Interface.Interface.InputBlockingComponents.ToArray();
for (int i = components.Length - 1; i >= 0; i--)
{
var inputBlockingComponent = Interface.Interface.InputBlockingComponents[i];
var inputBlockingComponent = components[i];
try
{
if (inputBlockingComponent is InputBox { IsHidden: false } inputBox)
Expand Down Expand Up @@ -229,10 +232,14 @@ public static void OnKeyPressed(Keys modifier, Keys key)
switch (control)
{
case Control.Enter:
if (!selectCharacterWindow.IsHidden && selectCharacterWindow.Characters[selectCharacterWindow.mSelectedChar] != null)
if (selectCharacterWindow is { IsHidden: false, CharacterSelectionPreviews: { } previews })
{
selectCharacterWindow.ButtonPlay_Clicked(null, null);
consumeKey = true;
var selectedPreviewIndex = selectCharacterWindow._selectedCharacterIndex;
if (previews.Length > selectedPreviewIndex && previews[selectedPreviewIndex] != default)
{
selectCharacterWindow.ButtonPlay_Clicked(null, null);
consumeKey = true;
}
}
break;
}
Expand Down Expand Up @@ -356,10 +363,31 @@ public static void OnKeyReleased(Keys modifier, Keys key)
}
}

public static void OnMouseDown(Keys modifier, MouseButton btn)
public static event MouseButtonEventInterceptor? MouseDownIntercept;

public static event MouseButtonEventInterceptor? MouseUpIntercept;

private static bool InvokeMouseButtonInterceptors(
MulticastDelegate? multicastDelegate,
Keys modifier,
MouseButton mouseButton
)
{
var rawInvocationList = multicastDelegate?.GetInvocationList() ?? [];
var invocationList = rawInvocationList.OfType<MouseButtonEventInterceptor>().ToArray();
return invocationList.Any(interceptor => interceptor(modifier, mouseButton));
}

public static bool TestInterceptMouse(Keys modifier, MouseButton mouseButton, bool down)
{
return modifier != Keys.Alt &&
InvokeMouseButtonInterceptors(down ? MouseDownIntercept : MouseUpIntercept, modifier, mouseButton);
}

public static void OnMouseDown(Keys modifier, MouseButton mouseButton)
{
var key = Keys.None;
switch (btn)
switch (mouseButton)
{
case MouseButton.Left:
key = Keys.LButton;
Expand Down Expand Up @@ -406,7 +434,7 @@ public static void OnMouseDown(Keys modifier, MouseButton btn)
return;
}

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

public static void OnMouseUp(Keys modifier, MouseButton btn)
public static void OnMouseUp(Keys modifier, MouseButton mouseButton)
{
var key = Keys.LButton;
switch (btn)
switch (mouseButton)
{
case MouseButton.Right:
key = Keys.RButton;
Expand Down Expand Up @@ -485,7 +513,7 @@ public static void OnMouseUp(Keys modifier, MouseButton btn)
return;
}

if (btn != MouseButton.Right)
if (mouseButton != MouseButton.Right)
{
return;
}
Expand Down
3 changes: 2 additions & 1 deletion Intersect.Client.Core/Core/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public static void Update(TimeSpan deltaTime)
Globals.InputManager.Update(deltaTime);
Audio.Update();

Time.Update();

Globals.OnGameUpdate(deltaTime);
}
}
Expand Down Expand Up @@ -267,7 +269,6 @@ private static void ProcessGame()
}

Graphics.UpdatePlayerLight();
Time.Update();
}

public static void JoinGame()
Expand Down
2 changes: 1 addition & 1 deletion Intersect.Client.Core/Entities/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Guid[] Equipment
public Guid Id { get; set; }

//Inventory/Spells/Equipment
public IItem[] Inventory { get; set; } = new IItem[Options.Instance.Player.MaxInventory];
public IItem[] Inventory { get; } = new IItem[Options.Instance.Player.MaxInventory];

IReadOnlyList<IItem> IEntity.Items => [.. Inventory];

Expand Down
16 changes: 4 additions & 12 deletions Intersect.Client.Core/Entities/Events/Dialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,11 @@ public partial class Dialog
{
public Guid EventId;

public string Face = string.Empty;
public string? Face;

public string Opt1 = string.Empty;
public string[] Options = [];

public string Opt2 = string.Empty;
public string? Prompt;

public string Opt3 = string.Empty;

public string Opt4 = string.Empty;

public string Prompt = string.Empty;

public int ResponseSent;

public int Type;
public bool ResponseSent;
}
Loading
Loading