dev #17

Merged
JacobTech merged 29 commits from dev into main 2024-04-11 15:50:14 -04:00
22 changed files with 333 additions and 99 deletions
Showing only changes of commit 6748e7548d - Show all commits

View File

@ -25,10 +25,12 @@ public class Settings
[JsonInclude] [JsonInclude]
[JsonPropertyName("default_display")] [JsonPropertyName("default_display")]
public int Display { get; set; } = 0; public int Display { get; set; } = 0;
/// <summary>
/// Sets the log value for the console. Default value of -25 to enable all logs by default except for DrawFrames and InfoOpenGL even if new ones are added.
/// </summary>
[JsonInclude] [JsonInclude]
[JsonPropertyName("log")] [JsonPropertyName("log")]
public ConsoleLog Logs { get; set; } = ConsoleLog.DrawFrames | ConsoleLog.BigErrosForOpenGL | public ConsoleLog Logs { get; set; } = (ConsoleLog)(-25);
ConsoleLog.MediumErrosForOpenGL | ConsoleLog.LowErrosForOpenGL;
[JsonInclude] [JsonInclude]
[JsonPropertyName("scale_fonts")] [JsonPropertyName("scale_fonts")]
public bool ScaleFonts { get; set; } = true; public bool ScaleFonts { get; set; } = true;
@ -37,7 +39,7 @@ public class Settings
public uint DefaultFontPX { get; set; } = 20; public uint DefaultFontPX { get; set; } = 20;
[JsonInclude] [JsonInclude]
[JsonPropertyName("top_time_font_px")] [JsonPropertyName("top_time_font_px")]
public uint TopTimeFonttPX { get; set; } = 11; public uint TopTimeFonttPX { get; set; } = 12;
[JsonInclude] [JsonInclude]
[JsonPropertyName("message_font_px")] [JsonPropertyName("message_font_px")]
public uint MessageFontPX { get; set; } = 17; public uint MessageFontPX { get; set; } = 17;

View File

@ -27,7 +27,7 @@ public class AccountButton : UserControl
IgnoreHover = true, IgnoreHover = true,
}; };
l.Location = new((base.Size.X / 2) - (l.Size.X / 2), l.Location = new((base.Size.X / 2) - (l.Size.X / 2),
(base.Size.Y / 2) - ((int)l.Font.PixelHeight) + (l.PostiveTrueHeight / 2) ((base.Size.Y - l.Size.Y) / 2)
, 0); , 0);
Controls.Add(l); Controls.Add(l);
BackgroundColor = new(0, 0, 0, 0); BackgroundColor = new(0, 0, 0, 0);

View File

@ -64,7 +64,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
Location = new(10.ScaleInt(),50.ScaleInt(), 0), Location = new(10.ScaleInt(),50.ScaleInt(), 0),
Size = s, Size = s,
WatermarkText = "Server Address", WatermarkText = "Server Address",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false AllowMultiLine = false
}; };
tb.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"); tb.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
@ -141,7 +141,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
}; };
ll2.Location = new((version.Size.X / 2) - (ll2.Size.X / 2), ll2.Location = new((version.Size.X / 2) - (ll2.Size.X / 2),
(version.Size.Y / 2) - ((int)ll2.Font.PixelHeight) + (ll2.PostiveTrueHeight / 2) ((version.Size.Y - ll2.Size.Y) / 2)
, 0); , 0);
version.Controls.Add(ll2); version.Controls.Add(ll2);
} }
@ -198,7 +198,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
Location = new(0, 10.ScaleInt(), 0), Location = new(0, 10.ScaleInt(), 0),
Size = new(page.Size.X, 30.ScaleInt()), Size = new(page.Size.X, 30.ScaleInt()),
WatermarkText = "Username", WatermarkText = "Username",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false AllowMultiLine = false
}); });
UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"); UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
@ -246,7 +246,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0), Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
Size = new(page.Size.X, UserName.Size.Y), Size = new(page.Size.X, UserName.Size.Y),
WatermarkText = "Password", WatermarkText = "Password",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false, AllowMultiLine = false,
PasswordChar = '●' PasswordChar = '●'
}); });
@ -295,7 +295,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
Location = new(0, Password.Location.Y + Password.Size.Y + UserName.Location.Y + UserName.Location.Y, 0), Location = new(0, Password.Location.Y + Password.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
Size = new(page.Size.X- tb.Location.X - rec.Size.X, Password.Size.Y ), Size = new(page.Size.X- tb.Location.X - rec.Size.X, Password.Size.Y ),
WatermarkText = "Display Name", WatermarkText = "Display Name",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false AllowMultiLine = false
}); });
DisplayName.KeyPress += args => DisplayName.KeyPress += args =>
@ -342,7 +342,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
}; };
ca.Size = new((Form.Size.X - tb.Location.X - tb.Location.X - (tb.Location.X / 2)) / 2, ca.Size.Y); ca.Size = new((Form.Size.X - tb.Location.X - tb.Location.X - (tb.Location.X / 2)) / 2, ca.Size.Y);
ca.l.Location = new((ca.Size.X - ca.l.Size.X) / 2, ca.l.Location = new((ca.Size.X - ca.l.Size.X) / 2,
(ca.Size.Y / 2) - ((int)ca.l.Font.PixelHeight) + (ca.l.PostiveTrueHeight / 2) ((ca.Size.Y - ca.l.Size.Y) / 2)
, 0); , 0);
ca.l.ForceDistanceUpdate(ca); ca.l.ForceDistanceUpdate(ca);
Form.Controls.Add(ca); Form.Controls.Add(ca);
@ -358,7 +358,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
Location = new(0, 22.ScaleInt(), 0), Location = new(0, 22.ScaleInt(), 0),
Size = new(page.Size.X, 31.ScaleInt()), Size = new(page.Size.X, 31.ScaleInt()),
WatermarkText = "Username", WatermarkText = "Username",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false AllowMultiLine = false
}); });
UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"); UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
@ -402,7 +402,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0), Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
Size = new(page.Size.X, UserName.Size.Y), Size = new(page.Size.X, UserName.Size.Y),
WatermarkText = "Password", WatermarkText = "Password",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false, AllowMultiLine = false,
PasswordChar = '●' PasswordChar = '●'
}); });
@ -449,7 +449,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
}; };
lo.Size = ca.Size; lo.Size = ca.Size;
lo.l.Location = new((lo.Size.X / 2) - (lo.l.Size.X / 2), lo.l.Location = new((lo.Size.X / 2) - (lo.l.Size.X / 2),
(lo.Size.Y / 2) - ((int)lo.l.Font.PixelHeight) + (lo.l.PostiveTrueHeight / 2) ((lo.Size.Y - lo.l.Size.Y) / 2)
, 0); , 0);
lo.l.ForceDistanceUpdate(lo); lo.l.ForceDistanceUpdate(lo);
Form.Controls.Add(lo); Form.Controls.Add(lo);
@ -482,7 +482,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
IgnoreHover = true IgnoreHover = true
}; };
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2), sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
(btn.Size.Y / 2) - ((int)sub.Font.PixelHeight) + (sub.PostiveTrueHeight / 2) ((btn.Size.Y - sub.Size.Y) / 2)
, 0); , 0);
sub.ForceDistanceUpdate(btn); sub.ForceDistanceUpdate(btn);
btn.Controls.Add(sub); btn.Controls.Add(sub);

View File

@ -1,34 +1,69 @@
using GraphicsManager.Objects; using GraphicsManager.Objects;
using Luski.net.Structures.Public; using Luski.net.Structures.Public;
using Luski.Shared.PublicServers.V1.Enums;
namespace Luski.GUI.MainScreen.UI.LuskiControls; namespace Luski.GUI.MainScreen.UI.LuskiControls;
public class RoleView : FlowLayout public class RoleView : FlowLayout
{ {
private string n = "";
private int i = 0;
private Label l; private Label l;
private Role r; private string n = "Offline";
public RoleView(Role r) public int i = 0;
public Role? r;
public RoleView(Role? r = null)
{ {
n = r.Name;
this.r = r; this.r = r;
Console.WriteLine(r.Name); if (r is not null) n = r.DisplayName;
l = new(Globals.DefaultFont) l = new(Globals.DefaultFont)
{ {
Text = " " + n + " — " + i.ToString(), Text = " " + n + " — " + i,
}; };
base.Size = new(0, 30.ScaleInt()); base.Size = new(0, 30.ScaleInt());
base.BackgroundColor = new(43, 45, 49, 255); base.BackgroundColor = new(34, 34, 34, 255);
Controls.Add(l); Controls.Add(l);
} }
public async Task AddUser(SocketUser user) private Dictionary<long, UserView> uuu = new();
public List<SocketUser> Users = new();
public async Task AddUser(SocketUser user, Role TopRole)
{ {
var f = await UserView.Make(user, r); UserView f = await UserView.Make(user, TopRole, r is null);
uuu.Add(user.Id, f);
bool ff = false;
for (int j = 0; j < Users.Count; j++)
{
if (string.Compare(Users[j].DisplayName, user.DisplayName) > 0)
{
Users.Insert(j, user);
Controls.Insert(j+1, f);
ff = true;
break;
}
}
if (!ff)
{
Users.Add(user);
Controls.Add(f); Controls.Add(f);
Size = new(Size.X, Size.Y + f.Size.Y); }
i++;
l.Text = " " + n + " — " + i.ToString(); Size = new(Size.X, Size.Y + f.Size.Y);
i++;
l.Text = " " + n + " — " + i;
}
public void RemoveUser(long id)
{
Size = new(Size.X, Size.Y - uuu[id].Size.Y);
i--;
l.Text = " " + n + " — " + i;
Users.Remove(uuu[id].User);
Controls.Remove(uuu[id]);
uuu.Remove(id);
for (int j = 0; j < Controls.Length; j++)
{
ReportSizeUpdate(Controls[i]);
}
} }
} }

View File

@ -40,7 +40,8 @@ public class TextBox : UserControl
}; };
Pointer = new() Pointer = new()
{ {
Size = new(1.ScaleInt(), (int)(Globals.DefaultFont.PixelHeight * ((float)Globals.DefaultFont.CurrentFonts[0].Face.Height/Globals.DefaultFont.CurrentFonts[0].Face.UnitsPerEM)) ), Size = new(1.ScaleInt(),
(int)_label.LineHeight ),
Location = _watermark.Location, Location = _watermark.Location,
BackgroundColor = Color4.White, BackgroundColor = Color4.White,
Visible = false Visible = false
@ -64,6 +65,7 @@ public class TextBox : UserControl
public override void UnFocus() public override void UnFocus()
{ {
use = false; use = false;
t.Stop();
Pointer.Visible = false; Pointer.Visible = false;
if (Window is not null && Window.focused == this) if (Window is not null && Window.focused == this)
Window.focused = null; Window.focused = null;
@ -108,7 +110,7 @@ public class TextBox : UserControl
public char? PasswordChar { get => _label.PasswordChar; set => _label.PasswordChar = value; } public char? PasswordChar { get => _label.PasswordChar; set => _label.PasswordChar = value; }
private TextLocation tl = TextLocation.PxLeft; private TextLocation tl = TextLocation.TopLeft;
public TextLocation TextLocation public TextLocation TextLocation
{ {
@ -120,8 +122,8 @@ public class TextBox : UserControl
{ {
_label.Location = value switch _label.Location = value switch
{ {
TextLocation.PostiveTureCenterLeft => new(10.ScaleInt(), TextLocation.LineCenter => new(10.ScaleInt(),
((Size.Y - _label.PostiveTrueHeight) / 2) - _label.Size.Y + _label.TrueHeight, Location.Z), ((Size.Y - _label.Size.Y) / 2), Location.Z),
_ => _label.Location _ => _label.Location
}; };
_watermark.Location = _label.Location; _watermark.Location = _label.Location;
@ -130,8 +132,8 @@ public class TextBox : UserControl
{ {
_watermark.Location = value switch _watermark.Location = value switch
{ {
TextLocation.PostiveTureCenterLeft => new(10.ScaleInt(), TextLocation.LineCenter => new(10.ScaleInt(),
((Size.Y - _watermark.PostiveTrueHeight) / 2) - _watermark.Size.Y + _watermark.TrueHeight, Location.Z), ((Size.Y - _watermark.Size.Y) / 2), Location.Z),
_ => _watermark.Location _ => _watermark.Location
}; };
_label.Location = _watermark.Location; _label.Location = _watermark.Location;
@ -181,7 +183,7 @@ public class TextBox : UserControl
get => _label.Text; get => _label.Text;
set set
{ {
int old = _label.TrueHeight; int old = _label.Size.Y;
_label.Text = value; _label.Text = value;
if (!string.IsNullOrEmpty(value)) if (!string.IsNullOrEmpty(value))
{ {
@ -192,7 +194,7 @@ public class TextBox : UserControl
_label.Visible = true; _label.Visible = true;
_label.Location = TextLocation switch _label.Location = TextLocation switch
{ {
TextLocation.PostiveTureCenterLeft => new(10.ScaleInt(), ((Size.Y - _label.PostiveTrueHeight) / 2) - _label.Size.Y + _label.TrueHeight, Location.Z), TextLocation.LineCenter => new(10.ScaleInt(), ((Size.Y - _label.Size.Y) / 2), Location.Z),
_ => _label.Location _ => _label.Location
}; };
/* /*
@ -206,7 +208,7 @@ public class TextBox : UserControl
_watermark.Location = _label.Location; _watermark.Location = _label.Location;
} }
if (_watermark.Visible) _watermark.Visible = false; if (_watermark.Visible) _watermark.Visible = false;
if (!f && TextLocation == TextLocation.TrueCenterLeft && old != _label.TrueHeight) if (!f && TextLocation == TextLocation.LineCenter && old != _label.Size.Y)
{ {
//_label.Location = new(Location.X + 5, Location.Y + ((Size.Y - _label.TrueHeight) / 2) - (_label.Size.Y - _label.TrueHeight), Location.Z); //_label.Location = new(Location.X + 5, Location.Y + ((Size.Y - _label.TrueHeight) / 2) - (_label.Size.Y - _label.TrueHeight), Location.Z);
_watermark.Location = _label.Location; _watermark.Location = _label.Location;
@ -220,7 +222,7 @@ public class TextBox : UserControl
_watermark.Visible = true; _watermark.Visible = true;
_watermark.Location = TextLocation switch _watermark.Location = TextLocation switch
{ {
TextLocation.PostiveTureCenterLeft => new(10.ScaleInt(), ((Size.Y - _watermark.PostiveTrueHeight) / 2) - _watermark.Size.Y + _watermark.TrueHeight, Location.Z), TextLocation.LineCenter => new(10.ScaleInt(), ((Size.Y - _watermark.Size.Y) / 2), Location.Z),
_ => _watermark.Location _ => _watermark.Location
}; };
/* /*
@ -327,6 +329,6 @@ public class TextBox : UserControl
use = true; use = true;
Focus(); Focus();
} }
else use = false; else UnFocus();
} }
} }

View File

@ -1,15 +1,19 @@
using GraphicsManager.Interfaces; using GraphicsManager.Interfaces;
using GraphicsManager.Objects; using GraphicsManager.Objects;
using Luski.net.Structures.Public; using Luski.net.Structures.Public;
using OpenTK.Mathematics;
namespace Luski.GUI.MainScreen.UI.LuskiControls; namespace Luski.GUI.MainScreen.UI.LuskiControls;
public class UserView : UserControl public class UserView : UserControl
{ {
private UserView(IRenderObject user, SocketUser u, Role r) public SocketUser User { get; set; }
private UserView(IRenderObject user, SocketUser u, Role r, bool offline)
{ {
this.User = u;
base.Size = new(244.ScaleInt(), 44.ScaleInt()); base.Size = new(244.ScaleInt(), 44.ScaleInt());
base.BackgroundColor = new(43, 45, 49, 255); base.BackgroundColor = new(34, 34, 34, 255);
user.Location = new(8.ScaleInt(), 6.ScaleInt(), 0); user.Location = new(8.ScaleInt(), 6.ScaleInt(), 0);
user.ForceDistanceUpdate(this); user.ForceDistanceUpdate(this);
Label uname = new(Globals.DefaultFont) Label uname = new(Globals.DefaultFont)
@ -17,15 +21,16 @@ public class UserView : UserControl
Text = u.DisplayName, Text = u.DisplayName,
Color = r.Color.ToColor4() Color = r.Color.ToColor4()
}; };
if (offline) uname.Color = new(uname.Color.R, uname.Color.G, uname.Color.B, uname.Color.A * 0.6f);
uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(), uname.Location = new(user.Location.X + user.Size.X + 8.ScaleInt(),
(user.Location.Y + (user.Size.Y / 2) - (uname.PostiveTrueHeight / 2) - uname.Size.Y + uname.TrueHeight), 0); (user.Location.Y + (user.Size.Y / 2) - (uname.Size.Y / 2)), 0);
Controls.Add(uname); Controls.Add(uname);
Controls.Add(user); Controls.Add(user);
} }
public static async Task<UserView> Make(SocketUser u, Role r) public static async Task<UserView> Make(SocketUser u, Role r, bool offline)
{ {
UserView m = new(await u.MakeRct(new(32.ScaleInt()), true), u, r); UserView m = new(await u.MakeRct(new(32.ScaleInt()), true), u, r, offline);
return m; return m;
} }
} }

View File

@ -21,7 +21,7 @@ public class VersionDropButton : DropDownOption
IgnoreHover = true IgnoreHover = true
}; };
l.Location = new((base.Size.X / 2) - (l.Size.X / 2), l.Location = new((base.Size.X / 2) - (l.Size.X / 2),
(base.Size.Y / 2) - ((int)l.Font.PixelHeight) + (l.PostiveTrueHeight / 2) ((base.Size.Y - l.Size.Y) / 2)
, 0); , 0);
Controls.Add(l); Controls.Add(l);
BackgroundColor = new(0, 0, 0, 0); BackgroundColor = new(0, 0, 0, 0);

View File

@ -36,7 +36,7 @@ public class AddChannel : UserControl
WatermarkText = "Channel Name", WatermarkText = "Channel Name",
Size = new(34.ScaleInt()), Size = new(34.ScaleInt()),
Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left | ObjectAnchor.Right, Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left | ObjectAnchor.Right,
TextLocation = TextLocation.PostiveTureCenterLeft TextLocation = TextLocation.LineCenter
}); });
fl.Controls.Add(new Label(Globals.DefaultFont) {Text = "Channel Description"}); fl.Controls.Add(new Label(Globals.DefaultFont) {Text = "Channel Description"});
fl.Controls.Add(cd =new TextBox() fl.Controls.Add(cd =new TextBox()
@ -44,7 +44,7 @@ public class AddChannel : UserControl
WatermarkText = "Channel Description", WatermarkText = "Channel Description",
Size = cn.Size, Size = cn.Size,
Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left | ObjectAnchor.Right, Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left | ObjectAnchor.Right,
TextLocation = TextLocation.PostiveTureCenterLeft TextLocation = TextLocation.LineCenter
}); });
fl.Controls.Add(new Label(Globals.DefaultFont) {Text = "\n "}); fl.Controls.Add(new Label(Globals.DefaultFont) {Text = "\n "});
fl.Controls.Add(btn = new(Globals.ms.TextureManager.GetTextureResource("Textbox.png")) fl.Controls.Add(btn = new(Globals.ms.TextureManager.GetTextureResource("Textbox.png"))
@ -58,7 +58,7 @@ public class AddChannel : UserControl
IgnoreHover = true IgnoreHover = true
}; };
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2), sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
(btn.Size.Y / 2) - ((int)sub.Font.PixelHeight) + (sub.PostiveTrueHeight / 2) ((btn.Size.Y - sub.Size.Y) / 2)
, 0); , 0);
btn.Clicked += BtnOnClicked; btn.Clicked += BtnOnClicked;
sub.ForceDistanceUpdate(btn); sub.ForceDistanceUpdate(btn);

View File

@ -52,7 +52,7 @@ public class Category : UserControl, IChannelAdder
IgnoreHover = true IgnoreHover = true
}); });
c.Clicked += c.AllOnClicked; c.Clicked += c.AllOnClicked;
c.Name.Location = new(26.ScaleInt(), ((c.Size.Y/2) - (c.Name.TrueHeight/ 2) - (c.Name.Size.Y - c.Name.TrueHeight)), 0); c.Name.Location = new(26.ScaleInt(), (((c.Size.Y - c.Name.Size.Y)/2)), 0);
c.Members = new() c.Members = new()
{ {
Anchor = ObjectAnchor.All, Anchor = ObjectAnchor.All,
@ -120,12 +120,12 @@ public class Category : UserControl, IChannelAdder
if (value) if (value)
{ {
ee.DIR = new(0,1); ee.DIR = new(0,1);
ee.Location = new(ee.Location.X, (ee.Location.Y - ee.PostiveTrueHeight), 0); ee.Location = new(ee.Location.X, (ee.Location.Y - ee.Size.Y), 0);
} }
else else
{ {
ee.DIR = new(1,0); ee.DIR = new(1,0);
ee.Location = new(ee.Location.X, (ee.Location.Y + ee.PostiveTrueHeight), 0); ee.Location = new(ee.Location.X, (ee.Location.Y + ee.Size.Y), 0);
} }
e = value; e = value;
} }

View File

@ -49,7 +49,7 @@ public class Channel : UserControl
Controls.Add(ChannelName); Controls.Add(ChannelName);
Clicked += AllOnClicked; Clicked += AllOnClicked;
ChannelName.Location = new(40.ScaleInt(), ChannelName.Location = new(40.ScaleInt(),
(base.Size.Y / 2) - ((int)ChannelName.Font.PixelHeight) + (ChannelName.PostiveTrueHeight / 2) ((base.Size.Y - ChannelName.Size.Y) / 2)
, 0); , 0);
base.HoverMouse = MouseCursor.Hand; base.HoverMouse = MouseCursor.Hand;
} }
@ -74,7 +74,7 @@ public class Channel : UserControl
Controls.Add(ChannelName); Controls.Add(ChannelName);
Clicked += AllOnClicked; Clicked += AllOnClicked;
ChannelName.Location = new(i, ChannelName.Location = new(i,
(base.Size.Y / 2) - ((int)ChannelName.Font.PixelHeight) + (ChannelName.PostiveTrueHeight / 2) ((base.Size.Y - ChannelName.Size.Y) / 2)
, 0); , 0);
base.HoverMouse = MouseCursor.Hand; base.HoverMouse = MouseCursor.Hand;
} }

View File

@ -19,9 +19,10 @@ public class ChatMessage : UserControl
public PublicChat pc; public PublicChat pc;
private IRenderObject LastObject; private IRenderObject LastObject;
public List<IRenderObject> MessageObjs = new();
private Label FirstL; private Label FirstL;
private readonly double HorPadding = 12.ScaleDouble(), public readonly double HorPadding = 12.ScaleDouble(),
VerticalPadding = 0.ScaleDouble(); VerticalPadding = 0.ScaleDouble();
private static Dictionary<MainSocketRemoteUser, List<ChatMessage>> Messages = new(); private static Dictionary<MainSocketRemoteUser, List<ChatMessage>> Messages = new();
@ -37,6 +38,8 @@ public class ChatMessage : UserControl
private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, IUser Author, IRenderObject UserIcon, Color4 UserNameColor) private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, IUser Author, IRenderObject UserIcon, Color4 UserNameColor)
{ {
pc = p; pc = p;
Label label1; Label label1;
base.Size = new(723.5.ScaleInt(), 37.ScaleInt()); base.Size = new(723.5.ScaleInt(), 37.ScaleInt());
@ -77,6 +80,7 @@ public class ChatMessage : UserControl
Label l; Label l;
Controls.Add(l = new Label(Globals.MessageFont) { Location = new(LastObject.Location.X, (int)(UserIcon.Location.Y + UserIcon.Size.Y - Globals.MessageFont.PixelHeight), 0), Text = message.Context}); Controls.Add(l = new Label(Globals.MessageFont) { Location = new(LastObject.Location.X, (int)(UserIcon.Location.Y + UserIcon.Size.Y - Globals.MessageFont.PixelHeight), 0), Text = message.Context});
LastObject = l; LastObject = l;
MessageObjs.Add(l);
} }
if (Msg.Files.Count > 0) if (Msg.Files.Count > 0)
@ -105,6 +109,7 @@ public class ChatMessage : UserControl
else base.Size = new(base.Size.X ,(int)(LastObject.Location.Y + LastObject.Size.Y + VerticalPadding)); else base.Size = new(base.Size.X ,(int)(LastObject.Location.Y + LastObject.Size.Y + VerticalPadding));
} }
public async Task AddMessage(SocketMessage msg) public async Task AddMessage(SocketMessage msg)
{ {
BlockDraw = true; BlockDraw = true;
@ -136,9 +141,11 @@ public class ChatMessage : UserControl
newLabel.MouseEnter += NewLabel_MouseEnter; newLabel.MouseEnter += NewLabel_MouseEnter;
newLabel.MouseLeave += NewLabel_MouseLeave; newLabel.MouseLeave += NewLabel_MouseLeave;
Controls.Add(newLabel); Controls.Add(newLabel);
MessageObjs.Add(newLabel);
LastObject = newLabel; LastObject = newLabel;
} }
if (msg.Files.Count > 0) if (msg.Files.Count > 0)
{ {
int row = 1; int row = 1;

View File

@ -5,6 +5,7 @@ using GraphicsManager.Interfaces;
using GraphicsManager.Objects; using GraphicsManager.Objects;
using Luski.GUI.MainScreen.UI.LuskiControls; using Luski.GUI.MainScreen.UI.LuskiControls;
using Luski.net.Structures.Public; using Luski.net.Structures.Public;
using Luski.Shared.PublicServers.V1.Enums;
using OpenTK.Mathematics; using OpenTK.Mathematics;
using OpenTK.Windowing.Common; using OpenTK.Windowing.Common;
using OpenTK.Windowing.Common.Input; using OpenTK.Windowing.Common.Input;
@ -28,7 +29,7 @@ public class PublicChat : UserControl
{ {
base.Size = new(980.ScaleInt(), 866.ScaleInt()); base.Size = new(980.ScaleInt(), 866.ScaleInt());
BackgroundColor = new(40,40,40,255); base.BackgroundColor = new(40,40,40,255);
Anchor = ObjectAnchor.All; Anchor = ObjectAnchor.All;
Controls.Add(MessageFlow = new() Controls.Add(MessageFlow = new()
{ {
@ -39,14 +40,22 @@ public class PublicChat : UserControl
HScrollPixels = Globals.Settings.PerScrollPixels, HScrollPixels = Globals.Settings.PerScrollPixels,
}); });
MessageFlow.FlowUpdate += MessageFlowOnFlowUpdate; MessageFlow.FlowUpdate += MessageFlowOnFlowUpdate;
if (LuskiExperiments.GUI.MessageLiveSize.IsEnabled()) MessageFlow.SizeChanged += OnSizeChanged;
LuskiExperiments.GUI.MessageLiveSize.EventToggled += MessageLiveSizeOnEventToggled;
Task MessageLiveSizeOnEventToggled(bool arg)
{
if (arg) MessageFlow.SizeChanged += OnSizeChanged;
else MessageFlow.SizeChanged -= OnSizeChanged;
return Task.CompletedTask;
}
Controls.Add(titlecon = new UserControl() Controls.Add(titlecon = new UserControl()
{ {
Anchor = ObjectAnchor.Left | ObjectAnchor.Top | ObjectAnchor.Right, Anchor = ObjectAnchor.Left | ObjectAnchor.Top | ObjectAnchor.Right,
Size = new(980.ScaleInt(), 48.ScaleInt()), Size = new(980.ScaleInt(), 48.ScaleInt()),
BackgroundColor = new(50,50,50,255), BackgroundColor = new(50,50,50,255),
}); });
if (LuskiExperiments.ServerExperiments.MemberList.IsEnabled()) if (LuskiExperiments.GUI.MemberList.IsEnabled())
{ {
UserCon = UserCon =
new(Globals.ms.TextureManager.GetTextureResource("person.png")) new(Globals.ms.TextureManager.GetTextureResource("person.png"))
@ -55,12 +64,14 @@ public class PublicChat : UserControl
Location = new(944.ScaleInt(), 12.ScaleInt(),0), Location = new(944.ScaleInt(), 12.ScaleInt(),0),
Anchor = ObjectAnchor.Right | ObjectAnchor.Top, Anchor = ObjectAnchor.Right | ObjectAnchor.Top,
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context], Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
BackgroundColor = Color4.Red BackgroundColor = Color4.LightGray
}; };
UserCon.MouseEnter += o => { UserCon.BackgroundColor = Color4.White; return Task.CompletedTask; };
UserCon.MouseLeave += o => { UserCon.BackgroundColor = Color4.LightGray; return Task.CompletedTask; };
UserCon.Clicked += UserConOnClicked; UserCon.Clicked += UserConOnClicked;
titlecon.Controls.Add(UserCon); titlecon.Controls.Add(UserCon);
} }
LuskiExperiments.ServerExperiments.MemberList.EventToggled += MemberListOnEventToggled; LuskiExperiments.GUI.MemberList.EventToggled += MemberListOnEventToggled;
titlecon.ForceDistanceUpdate(this); titlecon.ForceDistanceUpdate(this);
titlecon.Controls.Add(title = new Label(Globals.DefaultFont) titlecon.Controls.Add(title = new Label(Globals.DefaultFont)
@ -84,7 +95,7 @@ public class PublicChat : UserControl
//Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context], //Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
//Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context], //Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
BackgroundColor = Color4.Red, BackgroundColor = Color4.Red,
TextLocation = TextLocation.PostiveTureCenterLeft TextLocation = TextLocation.LineCenter
}); });
tb.KeyPress += TbOnKeyPress; tb.KeyPress += TbOnKeyPress;
tb.OnRemoveLine += TbOnOnRemoveLine; tb.OnRemoveLine += TbOnOnRemoveLine;
@ -94,6 +105,51 @@ public class PublicChat : UserControl
//Globals.Luski.MainServer.MessageReceived += LuskiOnMessageReceived; //Globals.Luski.MainServer.MessageReceived += LuskiOnMessageReceived;
} }
private bool ssss = false;
private Task OnSizeChanged(IRenderObject arg)
{
if (ssss) return Task.CompletedTask;
ssss = true;
BlockDraw = true;
bool off = false;
for (int j = 0; j < MessageFlow.Controls.Length; j++)
{
if (MessageFlow.Controls[j] is ChatMessage cm && cm.Controls.Length != 0 && cm.Location.Y + cm.Size.Y >= 0 && !off)
{
if (cm.MessageObjs[0] is Label First)
{
First.MaxSize = new(MessageFlow.Size.X - First.Location.X - 10.ScaleInt(), Int32.MaxValue);
First.ForceDistanceUpdate(cm);
}
for (int i = 1; i < cm.MessageObjs.Count; i++)
{
cm.MessageObjs[i].Location = new(cm.MessageObjs[i].Location.X,
cm.MessageObjs[i - 1].Location.Y + cm.MessageObjs[i - 1].Size.Y,
cm.MessageObjs[i].Location.Z);
cm.MessageObjs[i].ForceDistanceUpdate(cm);
if (cm.MessageObjs[i] is Label l)
{
l.MaxSize = new(MessageFlow.Size.X - l.Location.X - 10.ScaleInt(), Int32.MaxValue);
//l.Text = l.Text;
}
}
int ny = cm.MessageObjs.Last().Size.Y + cm.MessageObjs.Last().Location.Y + (int)cm.VerticalPadding;
if (cm.Location.Y + ny > MessageFlow.Size.Y) off = true;
if (cm.Size.Y != ny)
{
cm.Size = new(Size.X, ny);
MessageFlow.ReportSizeUpdate(cm);
}
ssss = false;
}
}
BlockDraw = false;
return Task.CompletedTask;
}
private async Task MessageFlowOnFlowUpdate(bool arg1, uint arg2, uint arg3) private async Task MessageFlowOnFlowUpdate(bool arg1, uint arg2, uint arg3)
{ {
if (!loadingm && arg1 && arg3 == 0 && (arg2 != 0 || MessageFlow.MaxScrollValue == 0)) if (!loadingm && arg1 && arg3 == 0 && (arg2 != 0 || MessageFlow.MaxScrollValue == 0))
@ -152,8 +208,10 @@ public class PublicChat : UserControl
Location = new(base.Size.X - 36.ScaleInt(), 12.ScaleInt(),0), Location = new(base.Size.X - 36.ScaleInt(), 12.ScaleInt(),0),
Anchor = ObjectAnchor.Right | ObjectAnchor.Top, Anchor = ObjectAnchor.Right | ObjectAnchor.Top,
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context], Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
BackgroundColor = Color4.Red BackgroundColor = Color4.LightGray
}; };
UserCon.MouseEnter += o => { UserCon.BackgroundColor = Color4.White; return Task.CompletedTask; };
UserCon.MouseLeave += o => { UserCon.BackgroundColor = Color4.LightGray; return Task.CompletedTask; };
UserCon.Clicked += UserConOnClicked; UserCon.Clicked += UserConOnClicked;
titlecon.Controls.Add(UserCon); titlecon.Controls.Add(UserCon);
} }
@ -166,6 +224,8 @@ public class PublicChat : UserControl
} }
private bool um_open = false; private bool um_open = false;
private bool SeperateOffline = true;
private async Task UserConOnClicked(IRenderObject arg) private async Task UserConOnClicked(IRenderObject arg)
{ {
@ -177,28 +237,125 @@ public class PublicChat : UserControl
int x = 232.ScaleInt(); int x = 232.ScaleInt();
memberflow = new() memberflow = new()
{ {
BackgroundColor = new(255, 0, 0, 255), BackgroundColor = new(34, 34, 34, 255),
Size = new(x, Size.Y - titlecon.Size.Y), Size = new(x, Size.Y - titlecon.Size.Y),
Location = new(Size.X - x, titlecon.Size.Y, 0) Location = new(Size.X - x, titlecon.Size.Y, 0),
Anchor = ObjectAnchor.Top | ObjectAnchor.Right | ObjectAnchor.Bottom
}; };
memberflow.ForceDistanceUpdate(this);
Controls.Add(memberflow); Controls.Add(memberflow);
Dictionary<long, RoleView> Roles = new();
foreach (var m in await Channel!.GetMembers())
{
Role top_role = (await m.GetRoles())[0];
if (!Roles.ContainsKey(top_role.ID))
{
Roles.Add(top_role.ID, new(top_role));
memberflow.Controls.Add(Roles[top_role.ID]);
}
Roles[top_role.ID].AddUser(m);
}
} }
if (memberflow.Controls.Length == 0)
{
Dictionary<long, RoleView> Roles = new();
RoleView? Offline = null;
Dictionary<long, RoleView> Users = new();
foreach (var m in (await Channel!.GetMembers()))
{
Role top_role = (await m.GetRoles())[0];
if (m.Status == UserStatus.Offline && SeperateOffline)
{
if (Offline is null)
{
Offline = new();
memberflow.Controls.Add(Offline);
}
await Offline.AddUser(m, top_role);
Users.Add(m.Id, Offline);
memberflow.ReportSizeUpdate(Offline);
}
else
{
if (!Roles.ContainsKey(top_role.ID))
{
Roles.Add(top_role.ID, new(top_role));
int _index_ = 0;
for (int index_ = memberflow.Controls.Length-1; index_ >= 0; index_--)
{
RoleView r = ((RoleView)memberflow.Controls[index_]);
if (r.r is null) continue;
if (r.r.Index > top_role.Index)
{
_index_ = index_ + 1;
break;
}
}
memberflow.Controls.Insert(_index_, Roles[top_role.ID]);
}
await Roles[top_role.ID].AddUser(m, top_role);
Users.Add(m.Id, Roles[top_role.ID]);
memberflow.ReportSizeUpdate(Roles[top_role.ID]);
}
}
Channel!.Server.StatusUpdate += async (status, user) =>
{
if (!SeperateOffline && !Users.ContainsKey(user.Id)) return;
Role top_role2 = (await user.GetRoles())[0];
Globals.ms.Invoke(async () =>
{
if (status == UserStatus.Offline && user.Status != UserStatus.Offline)
{
Offline!.RemoveUser(user.Id);
if (Offline.i == 0)
{
memberflow.Controls.Remove(Offline);
}
if (!Roles.ContainsKey(top_role2.ID))
{
Roles.Add(top_role2.ID, new(top_role2));
int _index_ = 0;
for (int index_ = memberflow.Controls.Length-1; index_ >= 0; index_--)
{
RoleView r = ((RoleView)memberflow.Controls[index_]);
if (r.r is null) continue;
if (r.r.Index > top_role2.Index)
{
_index_ = index_ + 1;
break;
}
}
memberflow.Controls.Insert(_index_, Roles[top_role2.ID]);
}
await Roles[top_role2.ID].AddUser(user, top_role2);
memberflow.ReportSizeUpdate(Roles[top_role2.ID]);
if (Offline is not null) memberflow.ReportSizeUpdate(Offline);
Users[user.Id] = Roles[top_role2.ID];
}
if (status != UserStatus.Offline && user.Status == UserStatus.Offline)
{
Users[user.Id].RemoveUser(user.Id);
if (Users[user.Id].i == 0)
{
if (Roles.ContainsKey(top_role2.ID)) Roles.Remove(top_role2.ID);
memberflow.Controls.Remove(Users[user.Id]);
}
if (Offline is null)
{
Offline = new();
memberflow.Controls.Add(Offline);
}
await Offline.AddUser(user, top_role2);
memberflow.ReportSizeUpdate(Offline);
memberflow.ReportSizeUpdate(Users[user.Id]);
Users[user.Id] = Offline;
}
Globals.ms.DrawFrame();
});
};
}
TryDraw();
memberflow.Visible = true; memberflow.Visible = true;
MessageFlow.Size = new(MessageFlow.Size.X - memberflow.Size.X, MessageFlow.Size.Y); MessageFlow.Size = new(MessageFlow.Size.X - memberflow.Size.X, MessageFlow.Size.Y);
MessageFlow.ForceDistanceUpdate(this);
tb.Size = new(tb.Size.X - memberflow.Size.X, tb.Size.Y); tb.Size = new(tb.Size.X - memberflow.Size.X, tb.Size.Y);
tb.ForceDistanceUpdate(); tb.ForceDistanceUpdate();
} }
@ -206,6 +363,7 @@ public class PublicChat : UserControl
{ {
memberflow!.Visible = false; memberflow!.Visible = false;
MessageFlow.Size = new(MessageFlow.Size.X + memberflow.Size.X, MessageFlow.Size.Y); MessageFlow.Size = new(MessageFlow.Size.X + memberflow.Size.X, MessageFlow.Size.Y);
MessageFlow.ForceDistanceUpdate(this);
tb.Size = new(tb.Size.X + memberflow.Size.X, tb.Size.Y); tb.Size = new(tb.Size.X + memberflow.Size.X, tb.Size.Y);
tb.ForceDistanceUpdate(); tb.ForceDistanceUpdate();
} }
@ -227,11 +385,23 @@ public class PublicChat : UserControl
Channel = channel; Channel = channel;
if (memberflow is not null) if (memberflow is not null)
{ {
BlockDraw = true;
await UserConOnClicked(UserCon!);
memberflow.Controls.Clear(); memberflow.Controls.Clear();
await UserConOnClicked(UserCon!);
BlockDraw = false;
} }
title.Text = channel.Name; title.Text = channel.Name;
var five = 5.ScaleInt();
title.Location = new(five + five,
(titlecon.Size.Y - ((int)(title.Font.PixelHeight * ((float)title.Font.CurrentFonts[0].Face.Height /
title.Font.CurrentFonts[0].Face.UnitsPerEM)))) / 2,
title.Location.Z);
desc.Text = channel.Description; desc.Text = channel.Description;
desc.Location = new((int)(title.Location.X + title.Size.X + 5.ScaleInt()), desc.Location.Y, 0); desc.Location = new((int)(title.Location.X + title.Size.X + five),
(titlecon.Size.Y - ((int)(desc.Font.PixelHeight * ((float)desc.Font.CurrentFonts[0].Face.Height /
desc.Font.CurrentFonts[0].Face.UnitsPerEM)))) / 2,
desc.Location.Z);
if (Window is not null) if (Window is not null)
{ {
Window.Title = $"{channel.Name} | {channel.Server.Name} - Luski"; Window.Title = $"{channel.Name} | {channel.Server.Name} - Luski";

View File

@ -65,7 +65,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
Size = s, Size = s,
Text = address, Text = address,
WatermarkText = "Server Address", WatermarkText = "Server Address",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false AllowMultiLine = false
}; };
tb.Textures[0] = Globals.ms.TextureManager.GetTextureResource("Textbox.png"); tb.Textures[0] = Globals.ms.TextureManager.GetTextureResource("Textbox.png");
@ -142,7 +142,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
}; };
ll2.Location = new((version.Size.X / 2) - (ll2.Size.X / 2), ll2.Location = new((version.Size.X / 2) - (ll2.Size.X / 2),
(version.Size.Y / 2) - ((int)ll2.Font.PixelHeight) + (ll2.PostiveTrueHeight / 2) ((version.Size.Y - ll2.Size.Y) / 2)
, 0); , 0);
version.Controls.Add(ll2); version.Controls.Add(ll2);
} }
@ -199,7 +199,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
Location = new(0, 10.ScaleInt(), 0), Location = new(0, 10.ScaleInt(), 0),
Size = new(page.Size.X, 30.ScaleInt()), Size = new(page.Size.X, 30.ScaleInt()),
WatermarkText = "Username", WatermarkText = "Username",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false AllowMultiLine = false
}); });
UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"); UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
@ -247,7 +247,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0), Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
Size = new(page.Size.X, UserName.Size.Y), Size = new(page.Size.X, UserName.Size.Y),
WatermarkText = "Password", WatermarkText = "Password",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false, AllowMultiLine = false,
PasswordChar = '●' PasswordChar = '●'
}); });
@ -296,7 +296,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
Location = new(0, Password.Location.Y + Password.Size.Y + UserName.Location.Y + UserName.Location.Y, 0), Location = new(0, Password.Location.Y + Password.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
Size = new(page.Size.X- tb.Location.X - rec.Size.X, Password.Size.Y ), Size = new(page.Size.X- tb.Location.X - rec.Size.X, Password.Size.Y ),
WatermarkText = "Display Name", WatermarkText = "Display Name",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false AllowMultiLine = false
}); });
DisplayName.KeyPress += args => DisplayName.KeyPress += args =>
@ -343,7 +343,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
}; };
ca.Size = new((Form.Size.X - tb.Location.X - tb.Location.X - (tb.Location.X / 2)) / 2, ca.Size.Y); ca.Size = new((Form.Size.X - tb.Location.X - tb.Location.X - (tb.Location.X / 2)) / 2, ca.Size.Y);
ca.l.Location = new((ca.Size.X - ca.l.Size.X) / 2, ca.l.Location = new((ca.Size.X - ca.l.Size.X) / 2,
(ca.Size.Y / 2) - ((int)ca.l.Font.PixelHeight) + (ca.l.PostiveTrueHeight / 2) ((ca.Size.Y - ca.l.Size.Y) / 2)
, 0); , 0);
ca.l.ForceDistanceUpdate(ca); ca.l.ForceDistanceUpdate(ca);
Form.Controls.Add(ca); Form.Controls.Add(ca);
@ -359,7 +359,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
Location = new(0, 22.ScaleInt(), 0), Location = new(0, 22.ScaleInt(), 0),
Size = new(page.Size.X, 31.ScaleInt()), Size = new(page.Size.X, 31.ScaleInt()),
WatermarkText = "Username", WatermarkText = "Username",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false AllowMultiLine = false
}); });
UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"); UserName.Textures[0] = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
@ -403,7 +403,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0), Location = new(0, UserName.Location.Y + UserName.Size.Y + UserName.Location.Y + UserName.Location.Y, 0),
Size = new(page.Size.X, UserName.Size.Y), Size = new(page.Size.X, UserName.Size.Y),
WatermarkText = "Password", WatermarkText = "Password",
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false, AllowMultiLine = false,
PasswordChar = '●' PasswordChar = '●'
}); });
@ -450,7 +450,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
}; };
lo.Size = ca.Size; lo.Size = ca.Size;
lo.l.Location = new((lo.Size.X / 2) - (lo.l.Size.X / 2), lo.l.Location = new((lo.Size.X / 2) - (lo.l.Size.X / 2),
(lo.Size.Y / 2) - ((int)lo.l.Font.PixelHeight) + (lo.l.PostiveTrueHeight / 2) ((lo.Size.Y - lo.l.Size.Y) / 2)
, 0); , 0);
lo.l.ForceDistanceUpdate(lo); lo.l.ForceDistanceUpdate(lo);
Form.Controls.Add(lo); Form.Controls.Add(lo);
@ -481,7 +481,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
IgnoreHover = true IgnoreHover = true
}; };
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2), sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
(btn.Size.Y / 2) - ((int)sub.Font.PixelHeight) + (sub.PostiveTrueHeight / 2) ((btn.Size.Y - sub.Size.Y) / 2)
, 0); , 0);
sub.ForceDistanceUpdate(btn); sub.ForceDistanceUpdate(btn);
btn.Controls.Add(sub); btn.Controls.Add(sub);

View File

@ -75,7 +75,7 @@ public class SettingsMenu : UserControl
IgnoreHover = true IgnoreHover = true
}; };
ll.Location = new(10.ScaleInt(), ll.Location = new(10.ScaleInt(),
(ThemeDrop!.Size.Y / 2) - ((int)ll.Font.PixelHeight) + (ll.PostiveTrueHeight / 2) ((ThemeDrop.Size.Y - ll.Size.Y) / 2)
, 0); , 0);
ThemeDrop.Controls.Add(ll); ThemeDrop.Controls.Add(ll);
}, },
@ -99,7 +99,7 @@ public class SettingsMenu : UserControl
IgnoreHover = true IgnoreHover = true
}; };
ll.Location = new(10.ScaleInt(), ll.Location = new(10.ScaleInt(),
(ThemeDrop!.Size.Y / 2) - ((int)ll.Font.PixelHeight) + (ll.PostiveTrueHeight / 2) ((ThemeDrop.Size.Y - ll.Size.Y) / 2)
, 0); , 0);
ThemeDrop.Controls.Add(ll); ThemeDrop.Controls.Add(ll);
}, },
@ -193,7 +193,7 @@ public class SettingsMenu : UserControl
WatermarkText = "Updater File", WatermarkText = "Updater File",
TextureDisplay = TextureDisplay.Center, TextureDisplay = TextureDisplay.Center,
Size = new(page.Size.X, 34.ScaleInt()), Size = new(page.Size.X, 34.ScaleInt()),
TextLocation = TextLocation.PostiveTureCenterLeft, TextLocation = TextLocation.LineCenter,
AllowMultiLine = false AllowMultiLine = false
}); });
t.KeyPress += args => t.KeyPress += args =>

View File

@ -27,7 +27,7 @@ public class CategoryButton : UserControl
IgnoreHover = true IgnoreHover = true
}; };
l.Location = new(5.ScaleInt(), l.Location = new(5.ScaleInt(),
(base.Size.Y / 2) - ((int)l.Font.PixelHeight) + (l.PostiveTrueHeight / 2) ((base.Size.Y - l.Size.Y) / 2)
, 0); , 0);
Controls.Add(l); Controls.Add(l);
BackgroundColor = new(0, 0, 0, 0); BackgroundColor = new(0, 0, 0, 0);

View File

@ -27,7 +27,7 @@ public class ExperimentDropButton : DropDownOption
IgnoreHover = true IgnoreHover = true
}; };
l.Location = new(10.ScaleInt(), l.Location = new(10.ScaleInt(),
(base.Size.Y / 2) - ((int)l.Font.PixelHeight) + (l.PostiveTrueHeight / 2) ((base.Size.Y - l.Size.Y) / 2)
, 0); , 0);
d = new(Globals.MessageFont) d = new(Globals.MessageFont)
{ {

View File

@ -60,7 +60,7 @@ public class ExperimentGUI : UserControl
IgnoreHover = true IgnoreHover = true
}; };
ll.Location = new(10.ScaleInt(), ll.Location = new(10.ScaleInt(),
(dd!.Size.Y / 2) - ((int)ll.Font.PixelHeight) + (ll.PostiveTrueHeight / 2) ((dd!.Size.Y - ll.Size.Y) / 2)
, 0); , 0);
dd.Controls.Add(ll); dd.Controls.Add(ll);
}, },
@ -116,7 +116,7 @@ public class ExperimentGUI : UserControl
IgnoreHover = true IgnoreHover = true
}; };
ll.Location = new(10.ScaleInt(), ll.Location = new(10.ScaleInt(),
(dd.Size.Y / 2) - ((int)ll.Font.PixelHeight) + (ll.PostiveTrueHeight / 2) ((dd.Size.Y - ll.Size.Y) / 2)
, 0); , 0);
dd.Controls.Add(ll); dd.Controls.Add(ll);
} }

View File

@ -27,7 +27,7 @@ public class ThemeDropButton : DropDownOption
IgnoreHover = true IgnoreHover = true
}; };
l.Location = new(10.ScaleInt(), l.Location = new(10.ScaleInt(),
(base.Size.Y / 2) - ((int)l.Font.PixelHeight) + (l.PostiveTrueHeight / 2) ((base.Size.Y - l.Size.Y) / 2)
, 0); , 0);
d = new(Globals.MessageFont) d = new(Globals.MessageFont)
{ {

View File

@ -1,7 +1,6 @@
using System.Diagnostics; using System.Diagnostics;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using GraphicsManager;
using GraphicsManager.Enums; using GraphicsManager.Enums;
using GraphicsManager.Interfaces; using GraphicsManager.Interfaces;
using GraphicsManager.Objects; using GraphicsManager.Objects;
@ -265,7 +264,7 @@ public class MainScreenWindow : Window
}; };
ul.Location = new(u.Location.X + u.Size.X + 5.ScaleInt(), ul.Location = new(u.Location.X + u.Size.X + 5.ScaleInt(),
(u.Location.Y + (u.Size.Y / 2) - (ul.PostiveTrueHeight / 2) - ul.Size.Y + ul.TrueHeight), 0); (u.Location.Y + ((u.Size.Y - ul.Size.Y) / 2)), 0);
SerBox.Controls.Add(ul); SerBox.Controls.Add(ul);
Rectangle setting = new(TextureManager.GetTextureResource("settings.png")) Rectangle setting = new(TextureManager.GetTextureResource("settings.png"))
{ {

View File

@ -192,8 +192,7 @@ public static class Globals
{ {
if (!TextureResources.ContainsKey(tm)) TextureResources.Add(tm, new()); if (!TextureResources.ContainsKey(tm)) TextureResources.Add(tm, new());
if (TextureResources[tm].TryGetValue(File, out Texture? t)) return t; if (TextureResources[tm].TryGetValue(File, out Texture? t)) return t;
t = tm.AddTexture(Tools.GetResourceStream(Assembly.GetExecutingAssembly(), t = tm.AddTexture(GetResource($"Textures.{File}"));
$"Luski.Resources.Textures.{File}"));
TextureResources[tm].Add(File,t); TextureResources[tm].Add(File,t);
return t; return t;
} }

View File

@ -21,8 +21,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GraphicsManager" Version="1.0.9-alpha07" /> <PackageReference Include="GraphicsManager" Version="1.0.9-alpha24" />
<PackageReference Include="Luski.net" Version="2.0.0-alpha76" /> <PackageReference Include="Luski.net" Version="2.0.0-alpha80" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -14,7 +14,16 @@ public static class LuskiExperiments
Name = "2023_12_member_list", Name = "2023_12_member_list",
Options = new() Options = new()
{ {
ServerExperiments.MemberList GUI.MemberList
}
},
new()
{
DisplayName = "Proper Message Label Size",
Name = "2024_04_label_size",
Options = new()
{
GUI.MessageLiveSize
} }
} }
}; };
@ -67,12 +76,18 @@ public static class LuskiExperiments
}; };
} }
public static class ServerExperiments public static class GUI
{ {
public static readonly ExperimentSelectorInfo MemberList = new() public static readonly ExperimentSelectorInfo MemberList = new()
{ {
Name = "Member List", Name = "Member List",
Description = "Adds a list on the side of a chat that shows members.",RequiresRestart = false Description = "Adds a list on the side of a chat that shows members.",RequiresRestart = false
}; };
public static readonly ExperimentSelectorInfo MessageLiveSize = new()
{
Name = "Proper Label Size",
Description = "Live updates messages to be the right length during resize.", RequiresRestart = false
};
} }
} }