Compare commits
No commits in common. "dff9100cf0f2d0e2ac52f21479aaac8a3331f14f" and "bd5405866b0f1f028fc6209ba1e7335412387fcb" have entirely different histories.
dff9100cf0
...
bd5405866b
@ -12,13 +12,7 @@ public class Settings
|
|||||||
{
|
{
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("scale")]
|
[JsonPropertyName("scale")]
|
||||||
[SettingInfo(SettingGroup.AppSettings, SettingsPage.Appearance)]
|
[SettingInfo(SettingGroup.AppSettings, SettingsPage.General)]
|
||||||
[Shared.GlobalAttributes.DisplayName("Message Font Size")]
|
|
||||||
[Description("Sets the px value for the message font size")]
|
|
||||||
[NumberSelector(typeof(double?))]
|
|
||||||
[NumberMin<double>(0.25)]
|
|
||||||
[NumberDefault<double>(1)]
|
|
||||||
[NumberMax<double>(2)]
|
|
||||||
public double? Scale { get; set; } = null;
|
public double? Scale { get; set; } = null;
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("perscrollpixels")]
|
[JsonPropertyName("perscrollpixels")]
|
||||||
@ -99,13 +93,6 @@ 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")]
|
||||||
[SettingInfo(SettingGroup.AppSettings, SettingsPage.Appearance)]
|
|
||||||
[Shared.GlobalAttributes.DisplayName("Top Time Font Size")]
|
|
||||||
[Description("Sets the px value for the top time font size")]
|
|
||||||
[NumberSelector(typeof(uint))]
|
|
||||||
[NumberMin<uint>(8)]
|
|
||||||
[NumberDefault<uint>(12)]
|
|
||||||
[NumberMax<uint>(20)]
|
|
||||||
public uint TopTimeFontPX { get; set; } = 12;
|
public uint TopTimeFontPX { get; set; } = 12;
|
||||||
[JsonInclude]
|
[JsonInclude]
|
||||||
[JsonPropertyName("role_settings_font_px")]
|
[JsonPropertyName("role_settings_font_px")]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using Luski.GUI.MainScreen.UI.Generic;
|
using Luski.GUI.MainScreen.UI.PublicServers;
|
||||||
using Luski.net.Structures.Public;
|
using Luski.net.Structures.Public;
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.Interfaces;
|
namespace Luski.GUI.MainScreen.Interfaces;
|
||||||
|
@ -13,7 +13,7 @@ using Rectangle = GraphicsManager.Objects.Rectangle;
|
|||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI;
|
namespace Luski.GUI.MainScreen.UI;
|
||||||
|
|
||||||
public class AddServerOverlayld : UserControl, IServerOverlay
|
public class AddServerOverlay : UserControl, IServerOverlay
|
||||||
{
|
{
|
||||||
private UserControl Form, btn;
|
private UserControl Form, btn;
|
||||||
private DropDown<VersionDropButton> version;
|
private DropDown<VersionDropButton> version;
|
||||||
@ -24,7 +24,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
|||||||
|
|
||||||
private Rectangle? rec;
|
private Rectangle? rec;
|
||||||
|
|
||||||
public AddServerOverlayld()
|
public AddServerOverlay()
|
||||||
{
|
{
|
||||||
base.Size = Globals.ms.ClientSize;
|
base.Size = Globals.ms.ClientSize;
|
||||||
base.BackgroundColor = new(0, 0, 0, 130);
|
base.BackgroundColor = new(0, 0, 0, 130);
|
||||||
@ -582,7 +582,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
|||||||
Globals.ServerList.Servers = l.ToArray();
|
Globals.ServerList.Servers = l.ToArray();
|
||||||
Globals.ServerList.SaveSettings(Path.Combine(Globals.LuskiPath, "Servers.json"), ServerListContext.Default.ServerList);
|
Globals.ServerList.SaveSettings(Path.Combine(Globals.LuskiPath, "Servers.json"), ServerListContext.Default.ServerList);
|
||||||
ServerIcon<PublicServer> ss = new ServerIcon<PublicServer>(ps);
|
ServerIcon<PublicServer> ss = new ServerIcon<PublicServer>(ps);
|
||||||
Globals.ms.ServerFlow.Controls.Insert(Globals.ms.ServerFlow.Controls.Length - 1, ss);
|
Globals.ms.ser.Controls.Insert(Globals.ms.ser.Controls.Length - 1, ss);
|
||||||
await ss.LoadServer();
|
await ss.LoadServer();
|
||||||
Globals.ms.Controls.Remove(this);
|
Globals.ms.Controls.Remove(this);
|
||||||
Globals.ms.TryDraw();
|
Globals.ms.TryDraw();
|
@ -1,285 +0,0 @@
|
|||||||
using GraphicsManager.Enums;
|
|
||||||
using GraphicsManager.Interfaces;
|
|
||||||
using GraphicsManager.Objects;
|
|
||||||
using GraphicsManager.Objects.Core;
|
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls.ServerForms;
|
|
||||||
using OpenTK.Mathematics;
|
|
||||||
using OpenTK.Windowing.GraphicsLibraryFramework;
|
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI;
|
|
||||||
|
|
||||||
public class AddServerOverlayForm : UserControl
|
|
||||||
{
|
|
||||||
private TextBox tb;
|
|
||||||
private CreateAccountUI caUI = new();
|
|
||||||
private DropDown<VersionDropButton> version;
|
|
||||||
private LoginUI lUI = new()
|
|
||||||
{
|
|
||||||
Visible = false
|
|
||||||
};
|
|
||||||
|
|
||||||
private UserControl btn;
|
|
||||||
|
|
||||||
private TextBox UsernameTB
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (lUI.Visible) return lUI.Username;
|
|
||||||
return caUI.Username;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextBox PasswordTB
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (lUI.Visible) return lUI.Password;
|
|
||||||
return caUI.Password;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AddServerOverlayForm()
|
|
||||||
:base(Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png"))
|
|
||||||
{
|
|
||||||
base.Size = new(350.ScaleInt(), 347.ScaleInt());
|
|
||||||
base.BackgroundColor = new(32, 32, 32, 255);
|
|
||||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
|
||||||
TextureDisplay = TextureDisplay.Center;
|
|
||||||
Label t;
|
|
||||||
Controls.Add(t=new Label(Globals.DefaultFont) { Scale = 1.6f, Text = "Add Server", Color = Globals.DodgerBlue });
|
|
||||||
t.Location = new((base.Size.X / 2) - (t.Size.X / 2), t.Location.Y, 0);
|
|
||||||
|
|
||||||
Label? ll = new Label(Globals.DefaultFont)
|
|
||||||
{
|
|
||||||
Text = net.API.DefaultVersion,
|
|
||||||
Color = Color4.DarkGray,
|
|
||||||
IgnoreHover = true
|
|
||||||
};
|
|
||||||
Vector2i s =new((int)(ll.Size.X * 1.6f),27.ScaleInt());
|
|
||||||
ll = null;
|
|
||||||
|
|
||||||
Rectangle line = new Rectangle()
|
|
||||||
{
|
|
||||||
Size = new Vector2i(1.ScaleInt()),
|
|
||||||
BackgroundColor = Globals.DodgerBlue
|
|
||||||
};
|
|
||||||
|
|
||||||
int ten = 10.ScaleInt();
|
|
||||||
|
|
||||||
tb = new("BadTextbox.png")
|
|
||||||
{
|
|
||||||
Location = new(ten,50.ScaleInt(), 0),
|
|
||||||
Size = (base.Size.X - ten - ten - ten - s.X, s.Y),
|
|
||||||
WatermarkText = "Server Address",
|
|
||||||
TextLocation = TextLocation.LineCenter,
|
|
||||||
AllowMultiLine = false
|
|
||||||
};
|
|
||||||
tb.LetterPress += () =>
|
|
||||||
{
|
|
||||||
Texture good = Globals.ms.TextureManager.GetTextureResource("Textbox.png");
|
|
||||||
|
|
||||||
if (tb.Textures[0].handel != good.handel)
|
|
||||||
{
|
|
||||||
tb.Textures[0] = good;
|
|
||||||
if (UsernameTB.Textures[0].handel == good.handel &&
|
|
||||||
PasswordTB.Textures[0].handel == good.handel &&
|
|
||||||
(lUI.Visible || caUI.Avatar.Textures.Count > 1) &&
|
|
||||||
btn!.Textures[0].handel != good.handel &&
|
|
||||||
tb.Textures[0].handel == good.handel)
|
|
||||||
{
|
|
||||||
btn.Textures[0] = good;
|
|
||||||
}
|
|
||||||
Globals.ms.TryDraw();
|
|
||||||
}
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
tb.LetterRemoved += () =>
|
|
||||||
{
|
|
||||||
Texture bad = Globals.ms.TextureManager.GetTextureResource("BadTextbox.png");
|
|
||||||
|
|
||||||
if (tb.Text.Length == 0 && tb.Textures[0].handel != bad.handel)
|
|
||||||
{
|
|
||||||
tb.Textures[0] = bad;
|
|
||||||
btn!.Textures[0] = bad;
|
|
||||||
Globals.ms.TryDraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
tb.KeyPress += args =>
|
|
||||||
{
|
|
||||||
if (args.Key == Keys.Tab && !args.Shift)
|
|
||||||
{
|
|
||||||
UsernameTB.Focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
|
|
||||||
Controls.Add(tb);
|
|
||||||
|
|
||||||
version = new DropDown<VersionDropButton>(Textures[0], line)
|
|
||||||
{
|
|
||||||
DropDownParentOverride = this,
|
|
||||||
Size = s,
|
|
||||||
BackgroundColor = new(255,20,20,255),
|
|
||||||
TextureDisplay = TextureDisplay.HorizontalCenter,
|
|
||||||
Shader = Shader,
|
|
||||||
Location = new(tb.Location.X + tb.Size.X + tb.Location.X, tb.Location.Y, 0)
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (string v in Globals.Luski.SupportedVersions)
|
|
||||||
{
|
|
||||||
VersionDropButton option = new VersionDropButton(s, v)
|
|
||||||
{
|
|
||||||
LoadDisplay = () =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Label ll2 = new Label(Globals.DefaultFont)
|
|
||||||
{
|
|
||||||
Text = v,
|
|
||||||
Color = Color4.DarkGray,
|
|
||||||
IgnoreHover = true,
|
|
||||||
|
|
||||||
};
|
|
||||||
ll2.Location = new((version.Size.X / 2) - (ll2.Size.X / 2),
|
|
||||||
((version.Size.Y - ll2.Size.Y) / 2)
|
|
||||||
, 0);
|
|
||||||
version.Controls.Add(ll2);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
version.AddOption(option);
|
|
||||||
if (v == net.API.DefaultVersion)
|
|
||||||
{
|
|
||||||
version.SetSelected(option);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
version.OpenStatusChanged += VersionOnOpenStatusChanged;
|
|
||||||
version.OptionSelected += VersionOnOptionSelected;
|
|
||||||
|
|
||||||
|
|
||||||
version.DropDownContainer.Textures.Add(Globals.ms.TextureManager.GetTextureResource("RoundedRectangleBottom.png"));
|
|
||||||
version.DropDownContainer.TextureDisplay = TextureDisplay.Center;
|
|
||||||
version.DropDownContainer.Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
|
||||||
version.DropDownContainer.BackgroundColor = version.BackgroundColor;
|
|
||||||
version.OpenStatusChanged += b =>
|
|
||||||
{
|
|
||||||
BlockDraw = true;
|
|
||||||
if (b)
|
|
||||||
{
|
|
||||||
version.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangleTop.png");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
version.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockDraw = false;
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
btn = new(Globals.ms.TextureManager.GetTextureResource("BadTextbox.png"))
|
|
||||||
{
|
|
||||||
Location = new(tb.Location.X, tb.Location.Y + tb.Size.Y + tb.Location.X, 0),
|
|
||||||
Size = new(tb.Size.X, tb.Size.Y),
|
|
||||||
TextureDisplay = TextureDisplay.Center
|
|
||||||
};
|
|
||||||
Label sub = new(Globals.DefaultFont)
|
|
||||||
{
|
|
||||||
Text = "Submit",
|
|
||||||
IgnoreHover = true
|
|
||||||
};
|
|
||||||
sub.Location = new((btn.Size.X / 2) - (sub.Size.X / 2),
|
|
||||||
((btn.Size.Y - sub.Size.Y) / 2)
|
|
||||||
, 0);
|
|
||||||
sub.ForceDistanceUpdate(btn);
|
|
||||||
btn.Controls.Add(sub);
|
|
||||||
Controls.Add(btn);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task VersionOnOpenStatusChanged(bool arg)
|
|
||||||
{
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task VersionOnOptionSelected(VersionDropButton arg)
|
|
||||||
{
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void ParentResize()
|
|
||||||
{
|
|
||||||
BlockDraw = true;
|
|
||||||
for (int i = 0; i < Controls.Length; i++)
|
|
||||||
{
|
|
||||||
if (!Controls[i].Loaded) continue;
|
|
||||||
bool top = (Controls[i].Anchor & ObjectAnchor.Top) == ObjectAnchor.Top;
|
|
||||||
bool left = (Controls[i].Anchor & ObjectAnchor.Left) == ObjectAnchor.Left;
|
|
||||||
bool right = (Controls[i].Anchor & ObjectAnchor.Right) == ObjectAnchor.Right;
|
|
||||||
bool bottom = (Controls[i].Anchor & ObjectAnchor.Bottom) == ObjectAnchor.Bottom;
|
|
||||||
if (!top && !bottom) { Controls[i].Anchor |= ObjectAnchor.Top; top = true; }
|
|
||||||
if (!left && !right) { Controls[i].Anchor |= ObjectAnchor.Left; left = true; }
|
|
||||||
|
|
||||||
int lx, ly, sy, sx;
|
|
||||||
bool UpdateDistance = false;
|
|
||||||
if ((Controls[i].Anchor & ObjectAnchor.PreventWidthChange) == ObjectAnchor.PreventWidthChange)
|
|
||||||
{
|
|
||||||
UpdateDistance = true;
|
|
||||||
lx = Controls[i].Location.X + ((Size.X - Controls[i].Distance.X - Controls[i].Size.X - Controls[i].Location.X) / 2);
|
|
||||||
sx = Controls[i].Size.X;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lx = (left ? Controls[i].Location.X : Size.X - Controls[i].Distance.X - Controls[i].Size.X);
|
|
||||||
sx = (right ? Size.X - Controls[i].Distance.X - lx : Controls[i].Size.X);
|
|
||||||
}
|
|
||||||
if ((Controls[i].Anchor & ObjectAnchor.PreventHeightChange) == ObjectAnchor.PreventHeightChange)
|
|
||||||
{
|
|
||||||
UpdateDistance = true;
|
|
||||||
ly = Controls[i].Location.Y + ((Size.Y - Controls[i].Distance.Y - Controls[i].Size.Y - Controls[i].Location.Y) / 2);
|
|
||||||
sy = Controls[i].Size.Y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ly = (top ? Controls[i].Location.Y : Size.Y - Controls[i].Distance.Y - Controls[i].Size.Y);
|
|
||||||
sy = (bottom ? Size.Y - Controls[i].Distance.Y - ly : Controls[i].Size.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool mooved = false;
|
|
||||||
Console.WriteLine(Controls[i].Location);
|
|
||||||
Console.WriteLine(Controls[i].Size);
|
|
||||||
Console.WriteLine("New X:{0} Y:{1} W:{2} H:{3}", lx, ly, sx, sy);
|
|
||||||
if (sx != Controls[i].Size.X || sy != Controls[i].Size.Y)
|
|
||||||
{
|
|
||||||
mooved = true;
|
|
||||||
Controls[i].SetSize(sx, sy);
|
|
||||||
}
|
|
||||||
if (lx != Controls[i].Location.X || ly != Controls[i].Location.Y)
|
|
||||||
{
|
|
||||||
mooved = true;
|
|
||||||
Controls[i].SetLocation(lx, ly);
|
|
||||||
}
|
|
||||||
if (UpdateDistance)
|
|
||||||
{
|
|
||||||
Controls[i].ForceDistanceUpdate(this);
|
|
||||||
}
|
|
||||||
Console.WriteLine(mooved);
|
|
||||||
if (Controls[i] is IParent parent)
|
|
||||||
{
|
|
||||||
Console.WriteLine(Controls[i]);
|
|
||||||
parent.ParentResize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Parent is not null) Parent.TryDraw();
|
|
||||||
BlockDraw = false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
using GraphicsManager.Enums;
|
|
||||||
using GraphicsManager.Interfaces;
|
|
||||||
using GraphicsManager.Objects;
|
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
|
||||||
|
|
||||||
public class CenterFullScreenBase : UserControl
|
|
||||||
{
|
|
||||||
private IRenderObject centerobj;
|
|
||||||
public CenterFullScreenBase(IRenderObject obj, bool Streach = false)
|
|
||||||
{
|
|
||||||
centerobj = obj;
|
|
||||||
if (!Streach) obj.Anchor = ObjectAnchor.Prevent;
|
|
||||||
else obj.Anchor = ObjectAnchor.All;
|
|
||||||
Controls.Add(obj);
|
|
||||||
base.BackgroundColor = new(0, 0, 0, 130);
|
|
||||||
Anchor = ObjectAnchor.All;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void LoadToParent(IParent p, IWindow w)
|
|
||||||
{
|
|
||||||
base.SetSize(w.CS.X, w.CS.Y);
|
|
||||||
centerobj.SetLocation((w.CS.X - centerobj.Size.X)/2, (w.CS.Y - centerobj.Size.Y)/2);
|
|
||||||
centerobj.ForceDistanceUpdate(this);
|
|
||||||
base.LoadToParent(p, w);
|
|
||||||
}
|
|
||||||
}
|
|
@ -183,7 +183,7 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
|||||||
public override void SetSize(int w, int h)
|
public override void SetSize(int w, int h)
|
||||||
{
|
{
|
||||||
base.SetSize(w, 50.ScaleInt());
|
base.SetSize(w, 50.ScaleInt());
|
||||||
progressBar.SetSize(w - space - space, 8.ScaleInt());
|
progressBar.SetSize(w, 8.ScaleInt());
|
||||||
progressBar.UpdateProgress();
|
progressBar.UpdateProgress();
|
||||||
progressBar.ForceDistanceUpdate(this);
|
progressBar.ForceDistanceUpdate(this);
|
||||||
Min = Min;
|
Min = Min;
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
using GraphicsManager.Objects;
|
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.LuskiControls.ServerForms;
|
|
||||||
|
|
||||||
public class CreateAccountUI : UserControl
|
|
||||||
{
|
|
||||||
public Rectangle Avatar = new();
|
|
||||||
public TextBox Username = new(), Password = new(), DisplayName = new();
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using GraphicsManager.Objects;
|
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.LuskiControls.ServerForms;
|
|
||||||
|
|
||||||
public class LoginUI : UserControl
|
|
||||||
{
|
|
||||||
public TextBox Username = new(), Password = new();
|
|
||||||
|
|
||||||
public LoginUI()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -41,13 +41,7 @@ public class SettingsMenu : UserControl
|
|||||||
};
|
};
|
||||||
closebtn.MouseLeave += _ =>
|
closebtn.MouseLeave += _ =>
|
||||||
{
|
{
|
||||||
if (bl) BlockDraw = true;
|
|
||||||
closebtn.BackgroundColor = Color4.Gray;
|
closebtn.BackgroundColor = Color4.Gray;
|
||||||
if (bl)
|
|
||||||
{
|
|
||||||
BlockDraw = false;
|
|
||||||
bl = false;
|
|
||||||
}
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
};
|
};
|
||||||
closebtn.Clicked += ClosebtnOnClicked;
|
closebtn.Clicked += ClosebtnOnClicked;
|
||||||
@ -55,11 +49,8 @@ public class SettingsMenu : UserControl
|
|||||||
Controls.Add(closebtn);
|
Controls.Add(closebtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool bl;
|
|
||||||
|
|
||||||
private Task ClosebtnOnClicked(IRenderObject arg)
|
private Task ClosebtnOnClicked(IRenderObject arg)
|
||||||
{
|
{
|
||||||
bl = true;
|
|
||||||
Globals.ms.Controls.Remove(this, false);
|
Globals.ms.Controls.Remove(this, false);
|
||||||
Globals.ms.Title = BehindName;
|
Globals.ms.Title = BehindName;
|
||||||
Globals.ms.DrawFrame();
|
Globals.ms.DrawFrame();
|
||||||
|
@ -20,8 +20,8 @@ public class TextBox : UserControl
|
|||||||
|
|
||||||
public int CursorLocation { get; set; }
|
public int CursorLocation { get; set; }
|
||||||
|
|
||||||
public TextBox(string defaul = "Textbox.png")
|
public TextBox()
|
||||||
:base(Globals.ms.TextureManager.GetTextureResource(defaul))
|
:base(Globals.ms.TextureManager.GetTextureResource("Textbox.png"))
|
||||||
{
|
{
|
||||||
t = new(500);
|
t = new(500);
|
||||||
t.Elapsed += TOnElapsed;
|
t.Elapsed += TOnElapsed;
|
||||||
@ -44,10 +44,8 @@ public class TextBox : UserControl
|
|||||||
(int)_label.LineHeight ),
|
(int)_label.LineHeight ),
|
||||||
Location = _watermark.Location,
|
Location = _watermark.Location,
|
||||||
BackgroundColor = Color4.White,
|
BackgroundColor = Color4.White,
|
||||||
Visible = false,
|
Visible = false
|
||||||
IgnoreHover = true
|
|
||||||
};
|
};
|
||||||
IgnoreVisForChildren = true;
|
|
||||||
Controls.Add(Pointer);
|
Controls.Add(Pointer);
|
||||||
|
|
||||||
Controls.Add(_label);
|
Controls.Add(_label);
|
||||||
|
@ -28,6 +28,7 @@ public class UserView : UserControl
|
|||||||
{
|
{
|
||||||
name = $"[gradient colors=\"{r.Colors.ToDB()}\"]{name}[/gradient]";
|
name = $"[gradient colors=\"{r.Colors.ToDB()}\"]{name}[/gradient]";
|
||||||
}
|
}
|
||||||
|
Console.WriteLine(name);
|
||||||
|
|
||||||
LuskiLabel uname = new(Globals.DefaultFont)
|
LuskiLabel uname = new(Globals.DefaultFont)
|
||||||
{
|
{
|
||||||
|
@ -77,18 +77,27 @@ public class Generic : PageFlow
|
|||||||
prop.SetValue(Globals.Settings, b);
|
prop.SetValue(Globals.Settings, b);
|
||||||
Globals.Settings.SaveSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings);
|
Globals.Settings.SaveSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings);
|
||||||
});
|
});
|
||||||
}
|
//AddSelector(prop, (uint)PropVal);
|
||||||
|
|
||||||
if (typeinfo.Kind.FullName == typeof(double?).FullName)
|
|
||||||
{
|
|
||||||
double? pv = (double?)PropVal;
|
|
||||||
Globals.AddNullNumberSlider(this, prop, pv, b =>
|
|
||||||
{
|
|
||||||
prop.SetValue(Globals.Settings, b);
|
|
||||||
Globals.Settings.SaveSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AddSelector<TNumber>(PropertyInfo prop , TNumber val) where TNumber : INumber<TNumber>
|
||||||
|
{
|
||||||
|
UserControl space = new();
|
||||||
|
space.BackgroundColor = Color4.Blue;
|
||||||
|
NumberSelector<TNumber> selector = new();
|
||||||
|
selector.BackgroundColor = this.BackgroundColor;
|
||||||
|
space.SetSize(Size.X, selector.Size.Y + 40.ScaleInt());
|
||||||
|
selector.SetSize(this.Size.X, 0);
|
||||||
|
selector.SetLocation(0,40.ScaleInt());
|
||||||
|
selector.Min = prop.GetAnyAttribute<NumberMin<TNumber>>().Min;
|
||||||
|
selector.Max = prop.GetAnyAttribute<NumberMax<TNumber>>().Max;
|
||||||
|
selector.Default = prop.GetAnyAttribute<NumberDefault<TNumber>>().Default;
|
||||||
|
selector.Value = val;
|
||||||
|
selector.Anchor = ObjectAnchor.All;
|
||||||
|
space.Controls.Add(selector);
|
||||||
|
Controls.Add(space);
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,9 +5,10 @@ using GraphicsManager.Objects.Core;
|
|||||||
using Luski.GUI.MainScreen.Interfaces;
|
using Luski.GUI.MainScreen.Interfaces;
|
||||||
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.Windowing.Common.Input;
|
using OpenTK.Windowing.Common.Input;
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.Generic;
|
namespace Luski.GUI.MainScreen.UI.PublicServers;
|
||||||
|
|
||||||
public class Category : UserControl, IChannelAdder
|
public class Category : UserControl, IChannelAdder
|
||||||
{
|
{
|
@ -3,13 +3,14 @@ using GraphicsManager.Interfaces;
|
|||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using GraphicsManager.Objects.Core;
|
using GraphicsManager.Objects.Core;
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||||
|
using Luski.net.Enums;
|
||||||
using Luski.net.Structures.Public;
|
using Luski.net.Structures.Public;
|
||||||
using Luski.Shared.PublicServers.V1.Enums;
|
using Luski.Shared.PublicServers.V1.Enums;
|
||||||
using OpenTK.Graphics.OpenGL4;
|
using OpenTK.Graphics.OpenGL4;
|
||||||
using OpenTK.Mathematics;
|
using OpenTK.Mathematics;
|
||||||
using OpenTK.Windowing.Common.Input;
|
using OpenTK.Windowing.Common.Input;
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.Generic;
|
namespace Luski.GUI.MainScreen.UI.PublicServers;
|
||||||
|
|
||||||
public class Channel : UserControl
|
public class Channel : UserControl
|
||||||
{
|
{
|
||||||
@ -105,19 +106,19 @@ public class Channel : UserControl
|
|||||||
CS.Selected = this;
|
CS.Selected = this;
|
||||||
IReadOnlyList<SocketMessage> m;
|
IReadOnlyList<SocketMessage> m;
|
||||||
m = await CurrentChannel.GetMessages(CancellationToken.None, Globals.Settings.LoadPerChannel);
|
m = await CurrentChannel.GetMessages(CancellationToken.None, Globals.Settings.LoadPerChannel);
|
||||||
Globals.ms.ChatBoxArea.ClearChat();
|
Globals.ms.pc.ClearChat();
|
||||||
await Globals.ms.ChatBoxArea.LoadChannel(CurrentChannel);
|
await Globals.ms.pc.LoadChannel(CurrentChannel);
|
||||||
mm = Globals.ms.ChatBoxArea.AddMessages(m);
|
mm = Globals.ms.pc.AddMessages(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mm is not null)
|
if (mm is not null)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Waiting");
|
Console.WriteLine("Waiting");
|
||||||
Task.WaitAll(mm);
|
Task.WaitAll(mm);
|
||||||
Globals.ms.ChatBoxArea.MessageFlow.ForceScrollUpdate();
|
Globals.ms.pc.MessageFlow.ForceScrollUpdate();
|
||||||
if (Globals.ms.ChatBoxArea.MessageFlow.Controls.Length > 1 && Globals.ms.ChatBoxArea.MessageFlow.Controls[Globals.ms.ChatBoxArea.MessageFlow.Controls.Length - 1].Location.Y + Globals.ms.ChatBoxArea.MessageFlow.Controls[Globals.ms.ChatBoxArea.MessageFlow.Controls.Length - 1].Size.Y > Globals.ms.ChatBoxArea.MessageFlow.Size.Y)
|
if (Globals.ms.pc.MessageFlow.Controls.Length > 1 && Globals.ms.pc.MessageFlow.Controls[Globals.ms.pc.MessageFlow.Controls.Length - 1].Location.Y + Globals.ms.pc.MessageFlow.Controls[Globals.ms.pc.MessageFlow.Controls.Length - 1].Size.Y > Globals.ms.pc.MessageFlow.Size.Y)
|
||||||
Globals.ms.ChatBoxArea.MessageFlow.ScrollToBottom();
|
Globals.ms.pc.MessageFlow.ScrollToBottom();
|
||||||
else Globals.ms.ChatBoxArea.MessageFlow.ScrollToTop();
|
else Globals.ms.pc.MessageFlow.ScrollToTop();
|
||||||
Console.WriteLine("Done");
|
Console.WriteLine("Done");
|
||||||
}
|
}
|
||||||
BlockDraw = false;
|
BlockDraw = false;
|
@ -1,25 +1,32 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using GraphicsManager.Enums;
|
||||||
using GraphicsManager.Interfaces;
|
using GraphicsManager.Interfaces;
|
||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using Luski.GUI.MainScreen.Interfaces;
|
using Luski.GUI.MainScreen.Interfaces;
|
||||||
using Luski.GUI.MainScreen.UI.PublicServers;
|
|
||||||
using Luski.net.Structures.Public;
|
using Luski.net.Structures.Public;
|
||||||
using Luski.Shared.PublicServers.V1.Enums;
|
using Luski.Shared.PublicServers.V1.Enums;
|
||||||
|
using OpenTK.Mathematics;
|
||||||
|
|
||||||
namespace Luski.GUI.MainScreen.UI.Generic;
|
namespace Luski.GUI.MainScreen.UI.PublicServers;
|
||||||
|
|
||||||
public class ChannelSelector : FlowLayout, IChannelAdder
|
public class ChannelSelector : FlowLayout, IChannelAdder
|
||||||
{
|
{
|
||||||
public SocketCategory CurrentCategory { get; private set; }
|
public SocketCategory CurrentCategory { get; }
|
||||||
private readonly List<Category> cc = new();
|
private readonly List<Category> cc = new();
|
||||||
private readonly List<Channel> LoadedChannels = new();
|
private readonly List<Channel> LoadedChannels = new();
|
||||||
public Dictionary<long, IChannelAdder> ChannelAdders = new();
|
public Dictionary<long, IChannelAdder> ChannelAdders = new();
|
||||||
public Channel? Selected;
|
public Channel? Selected;
|
||||||
|
|
||||||
public async Task LoadSelectorRoot(SocketCategory Cat)
|
private ChannelSelector(SocketCategory Cat)
|
||||||
{
|
{
|
||||||
CurrentCategory = Cat;
|
CurrentCategory = Cat;
|
||||||
ChannelAdders.Add(Cat.ID, this);
|
ChannelAdders.Add(Cat.ID, this);
|
||||||
Cat.Server.MessageReceived += ServerOnMessageReceived;
|
Cat.Server.MessageReceived += ServerOnMessageReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<ChannelSelector> MakeSelector(SocketCategory Cat)
|
||||||
|
{
|
||||||
|
ChannelSelector cs = new(Cat);
|
||||||
bool MakeChannels = await Cat.Server.User.HasAccessToCategory(Cat, ServerPermission.CreateChannels);
|
bool MakeChannels = await Cat.Server.User.HasAccessToCategory(Cat, ServerPermission.CreateChannels);
|
||||||
bool MakeRoles = await Cat.Server.User.HasPermissions(ServerPermission.ManageRoles);
|
bool MakeRoles = await Cat.Server.User.HasPermissions(ServerPermission.ManageRoles);
|
||||||
if (MakeChannels || MakeRoles)
|
if (MakeChannels || MakeRoles)
|
||||||
@ -28,15 +35,17 @@ public class ChannelSelector : FlowLayout, IChannelAdder
|
|||||||
if (MakeChannels)
|
if (MakeChannels)
|
||||||
{
|
{
|
||||||
Label l = lcm.AddLabel("Create Channel");
|
Label l = lcm.AddLabel("Create Channel");
|
||||||
l.Clicked += LOnClicked;
|
l.Clicked += cs.LOnClicked;
|
||||||
}
|
}
|
||||||
if (MakeRoles)
|
if (MakeRoles)
|
||||||
{
|
{
|
||||||
Label l = lcm.AddLabel("Create Role");
|
Label l = lcm.AddLabel("Create Role");
|
||||||
l.Clicked += RLOnClicked;
|
l.Clicked += cs.RLOnClicked;
|
||||||
}
|
}
|
||||||
ContextMenu = lcm;
|
cs.ContextMenu = lcm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RLOnClicked(IRenderObject arg)
|
private async Task RLOnClicked(IRenderObject arg)
|
||||||
@ -54,8 +63,8 @@ public class ChannelSelector : FlowLayout, IChannelAdder
|
|||||||
private async Task ServerOnMessageReceived(SocketMessage arg)
|
private async Task ServerOnMessageReceived(SocketMessage arg)
|
||||||
{
|
{
|
||||||
if (Selected is null || arg.ChannelID != Selected.CurrentChannel.ID) return;
|
if (Selected is null || arg.ChannelID != Selected.CurrentChannel.ID) return;
|
||||||
bool u = Globals.ms.ChatBoxArea.MessageFlow.MaxScrollValue == Globals.ms.ChatBoxArea.MessageFlow.ScrollValue;
|
bool u = Globals.ms.pc.MessageFlow.MaxScrollValue == Globals.ms.pc.MessageFlow.ScrollValue;
|
||||||
await Globals.ms.ChatBoxArea.AddMessage(arg, u);
|
await Globals.ms.pc.AddMessage(arg, u);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,6 @@ using GraphicsManager.Interfaces;
|
|||||||
using GraphicsManager.Objects;
|
using GraphicsManager.Objects;
|
||||||
using GraphicsManager.Objects.Core;
|
using GraphicsManager.Objects.Core;
|
||||||
using Luski.GUI.MainScreen.UI;
|
using Luski.GUI.MainScreen.UI;
|
||||||
using Luski.GUI.MainScreen.UI.Generic;
|
|
||||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||||
using Luski.GUI.MainScreen.UI.LuskiSettings;
|
using Luski.GUI.MainScreen.UI.LuskiSettings;
|
||||||
using Luski.GUI.MainScreen.UI.PublicServers;
|
using Luski.GUI.MainScreen.UI.PublicServers;
|
||||||
@ -37,7 +36,7 @@ public class MainScreenWindow : Window
|
|||||||
APIVersion = new Version(3, 2),
|
APIVersion = new Version(3, 2),
|
||||||
API = ContextAPI.OpenGL,
|
API = ContextAPI.OpenGL,
|
||||||
StartFocused = true,
|
StartFocused = true,
|
||||||
ClientSize = new Vector2i(624, 1090),
|
Size = new Vector2i(624, 1090),
|
||||||
Icon = Globals.Icon,
|
Icon = Globals.Icon,
|
||||||
SharedContext = null,
|
SharedContext = null,
|
||||||
};
|
};
|
||||||
@ -121,6 +120,7 @@ public class MainScreenWindow : Window
|
|||||||
ShowMissingChar = true;
|
ShowMissingChar = true;
|
||||||
LogFrames = ((Globals.Settings.Logs & ConsoleLog.DrawFrames) == ConsoleLog.DrawFrames);
|
LogFrames = ((Globals.Settings.Logs & ConsoleLog.DrawFrames) == ConsoleLog.DrawFrames);
|
||||||
VSync = VSyncMode.On;
|
VSync = VSyncMode.On;
|
||||||
|
|
||||||
GL.DebugMessageCallback(DebugMessageDelegate, IntPtr.Zero);
|
GL.DebugMessageCallback(DebugMessageDelegate, IntPtr.Zero);
|
||||||
GL.Enable(EnableCap.DebugOutput);
|
GL.Enable(EnableCap.DebugOutput);
|
||||||
GLFW.SetErrorCallback(GLFW_Error);
|
GLFW.SetErrorCallback(GLFW_Error);
|
||||||
@ -150,6 +150,7 @@ public class MainScreenWindow : Window
|
|||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Globals.DefaultFont.PixelHeight = Globals.Settings.DefaultFontPX.ScaleFont();
|
Globals.DefaultFont.PixelHeight = Globals.Settings.DefaultFontPX.ScaleFont();
|
||||||
Globals.DefaultFont.FontSize = FontSize.Regular;
|
Globals.DefaultFont.FontSize = FontSize.Regular;
|
||||||
Globals.TopTimeFont = Globals.DefaultFont.Clone();
|
Globals.TopTimeFont = Globals.DefaultFont.Clone();
|
||||||
@ -174,13 +175,10 @@ public class MainScreenWindow : Window
|
|||||||
CenterWindow();
|
CenterWindow();
|
||||||
}
|
}
|
||||||
WindowLoaded += OnWindowLoaded;
|
WindowLoaded += OnWindowLoaded;
|
||||||
BlockDraw = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnWindowLoaded(Window arg)
|
private async Task OnWindowLoaded(Window arg)
|
||||||
{
|
{
|
||||||
BlockDraw = false;
|
|
||||||
Console.WriteLine("start");
|
|
||||||
if (Globals.UpdaterSettings.AutoUpdateCheck && new HttpClient()
|
if (Globals.UpdaterSettings.AutoUpdateCheck && new HttpClient()
|
||||||
.GetAsync(
|
.GetAsync(
|
||||||
$"https://www.jacobtech.com/Updater/GetProgramVersion?directory=Luski&branch=main&selfcontained={Globals.UpdaterSettings.SelfContained.ToString().ToLower()}&platform={Globals.UpdaterSettings.Platform}")
|
$"https://www.jacobtech.com/Updater/GetProgramVersion?directory=Luski&branch=main&selfcontained={Globals.UpdaterSettings.SelfContained.ToString().ToLower()}&platform={Globals.UpdaterSettings.Platform}")
|
||||||
@ -198,10 +196,9 @@ public class MainScreenWindow : Window
|
|||||||
await LoginOnChangeToApp();
|
await LoginOnChangeToApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlowLayout ServerFlow;
|
public FlowLayout ser;
|
||||||
private UserControl SerBox, ServerTitle;
|
private UserControl? SerBox;
|
||||||
public PublicChat ChatBoxArea;
|
public PublicChat pc;
|
||||||
public ChannelSelector ChannelSelector;
|
|
||||||
|
|
||||||
public async Task LoadPublicServer(PublicServer? Server)
|
public async Task LoadPublicServer(PublicServer? Server)
|
||||||
{
|
{
|
||||||
@ -214,25 +211,38 @@ public class MainScreenWindow : Window
|
|||||||
ServerLoginOverlay SLO = new(Server.Domain);
|
ServerLoginOverlay SLO = new(Server.Domain);
|
||||||
Controls.Add(SLO);
|
Controls.Add(SLO);
|
||||||
ForceUpdate();
|
ForceUpdate();
|
||||||
|
Globals.PrintParent(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BlockDraw = true;
|
BlockDraw = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#region Control Removing
|
#region Box Init
|
||||||
|
|
||||||
|
if (SerBox is null)
|
||||||
|
{
|
||||||
|
SerBox = new()
|
||||||
|
{
|
||||||
|
Location = new(ser.Size.X, 0, 0),
|
||||||
|
Size = new(Size.X - ser.Size.X, CS.Y),
|
||||||
|
Anchor = ObjectAnchor.All,
|
||||||
|
BackgroundColor = new(20, 20, 20, 255)
|
||||||
|
};
|
||||||
|
Controls.Add(SerBox);
|
||||||
|
SerBox.LoadToParent(this, this);
|
||||||
|
}
|
||||||
|
|
||||||
ServerTitle.Controls.Clear();
|
|
||||||
ChannelSelector.Controls.Clear();
|
|
||||||
SerBox.Controls.Remove(ServerTitle, false);
|
|
||||||
SerBox.Controls.Remove(ChannelSelector, false);
|
|
||||||
SerBox.Controls.Clear();
|
SerBox.Controls.Clear();
|
||||||
SerBox.Controls.Add(ServerTitle);
|
|
||||||
SerBox.Controls.Add(ChannelSelector);
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Server Title
|
#region Server Title
|
||||||
|
|
||||||
|
UserControl ServerTitle = new()
|
||||||
|
{
|
||||||
|
Size = new(307.ScaleInt(), 46.ScaleInt()),
|
||||||
|
BackgroundColor = new(30, 30, 30, 255)
|
||||||
|
};
|
||||||
Label title = new(Globals.DefaultFont)
|
Label title = new(Globals.DefaultFont)
|
||||||
{
|
{
|
||||||
Text = Server.Name,
|
Text = Server.Name,
|
||||||
@ -270,29 +280,35 @@ public class MainScreenWindow : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
parents.Reverse();
|
parents.Reverse();
|
||||||
await ChannelSelector.LoadSelectorRoot(parents[0]);
|
ChannelSelector cs = await ChannelSelector.MakeSelector(parents[0]);
|
||||||
|
cs.BackgroundColor = new(34, 34, 34, 255);
|
||||||
|
cs.Location = new(0, ServerTitle.Size.Y +2.ScaleInt(), 0);
|
||||||
|
cs.Size = new(ServerTitle.Size.X, SerBox.Size.Y - 54.ScaleInt() - cs.Location.Y);
|
||||||
|
cs.Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom;
|
||||||
|
|
||||||
parents.RemoveAt(0);
|
parents.RemoveAt(0);
|
||||||
|
SerBox.Controls.Add(cs);
|
||||||
|
cs.ForceDistanceUpdate(SerBox);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Chat Init
|
#region Chat Init
|
||||||
|
|
||||||
ChatBoxArea = new()
|
pc = new()
|
||||||
{
|
{
|
||||||
Anchor = ObjectAnchor.All,
|
Anchor = ObjectAnchor.All,
|
||||||
Location = new(ChannelSelector.Size.X, 0, 0),
|
Location = new(cs.Size.X, 0, 0),
|
||||||
Size = new(SerBox.Size.X - ChannelSelector.Size.X, SerBox.Size.Y),
|
Size = new(SerBox.Size.X - cs.Size.X, SerBox.Size.Y),
|
||||||
};
|
};
|
||||||
SerBox.Controls.Add(ChatBoxArea);
|
SerBox.Controls.Add(pc);
|
||||||
ChatBoxArea.LoadToParent(SerBox, this);
|
pc.LoadToParent(SerBox, this);
|
||||||
ChatBoxArea.ForceDistanceUpdate();
|
pc.ForceDistanceUpdate();
|
||||||
ChatBoxArea.MessageFlow.ForceDistanceUpdate(ChatBoxArea);
|
pc.MessageFlow.ForceDistanceUpdate(pc);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Channel Selector Loader
|
#region Channel Selector Loader
|
||||||
|
|
||||||
_ = ChannelSelector.Load(current_channel, parents);
|
_ = cs.Load(current_channel, parents);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -300,7 +316,7 @@ public class MainScreenWindow : Window
|
|||||||
ServerProfile DefaultProfile = await Server.GetProfile(Server.User.ServerProfile, CancellationToken.None);
|
ServerProfile DefaultProfile = await Server.GetProfile(Server.User.ServerProfile, CancellationToken.None);
|
||||||
IRenderObject u = await DefaultProfile.MakeRct(Server.User, new(46.ScaleInt()));
|
IRenderObject u = await DefaultProfile.MakeRct(Server.User, new(46.ScaleInt()));
|
||||||
int ii = 4.ScaleInt();
|
int ii = 4.ScaleInt();
|
||||||
u.Location = new(ii, ChannelSelector.Location.Y + ChannelSelector.Size.Y + ii, 0);
|
u.Location = new(ii, cs.Location.Y + cs.Size.Y + ii, 0);
|
||||||
u.Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left;
|
u.Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left;
|
||||||
SerBox.Controls.Add(u);
|
SerBox.Controls.Add(u);
|
||||||
u.LoadToParent(SerBox, this);
|
u.LoadToParent(SerBox, this);
|
||||||
@ -348,12 +364,11 @@ public class MainScreenWindow : Window
|
|||||||
SerBox.Controls.Add(ul);
|
SerBox.Controls.Add(ul);
|
||||||
Rectangle setting = new(TextureManager.GetTextureResource("settings.png"))
|
Rectangle setting = new(TextureManager.GetTextureResource("settings.png"))
|
||||||
{
|
{
|
||||||
Location = new(ChannelSelector.Size.X - 40.ScaleInt(), ChannelSelector.Location.Y + ChannelSelector.Size.Y + 11.ScaleInt(),0),
|
Location = new(cs.Size.X - 40.ScaleInt(), cs.Location.Y + cs.Size.Y + 11.ScaleInt(),0),
|
||||||
Size = new(32.ScaleInt()),
|
Size = new(32.ScaleInt()),
|
||||||
Shader = Rectangle.DefaultAlphaShader[Context],
|
Shader = Rectangle.DefaultAlphaShader[Context],
|
||||||
BackgroundColor = Color4.Gray,
|
BackgroundColor = Color4.Gray,
|
||||||
Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left,
|
Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left
|
||||||
BlendOverride = true
|
|
||||||
};
|
};
|
||||||
setting.MouseEnter += _ =>
|
setting.MouseEnter += _ =>
|
||||||
{
|
{
|
||||||
@ -416,7 +431,7 @@ public class MainScreenWindow : Window
|
|||||||
ProfileFlow.Size = new((int)arg.SizeAsFloat.X, ProfileFlow.Size.Y + con.Size.Y);
|
ProfileFlow.Size = new((int)arg.SizeAsFloat.X, ProfileFlow.Size.Y + con.Size.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileFlow.Location = new(ServerFlow.Size.X + 5.ScaleInt(),
|
ProfileFlow.Location = new(ser.Size.X + 5.ScaleInt(),
|
||||||
CS.Y - 54.ScaleInt() - ProfileFlow.Size.Y,
|
CS.Y - 54.ScaleInt() - ProfileFlow.Size.Y,
|
||||||
0);
|
0);
|
||||||
Controls.Add(ProfileFlow);
|
Controls.Add(ProfileFlow);
|
||||||
@ -434,15 +449,10 @@ public class MainScreenWindow : Window
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private GlobalSettingsMenu? gsm;
|
|
||||||
|
|
||||||
private Task SettingOnClicked(IRenderObject arg)
|
private Task SettingOnClicked(IRenderObject arg)
|
||||||
{
|
{
|
||||||
if (gsm is null)
|
GlobalSettingsMenu sm = new();
|
||||||
{
|
Controls.Add(sm);
|
||||||
gsm = new GlobalSettingsMenu();
|
|
||||||
}
|
|
||||||
Controls.Add(gsm);
|
|
||||||
Globals.ms.DrawFrame();
|
Globals.ms.DrawFrame();
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@ -452,8 +462,8 @@ public class MainScreenWindow : Window
|
|||||||
if (SerBox is null)
|
if (SerBox is null)
|
||||||
SerBox = new()
|
SerBox = new()
|
||||||
{
|
{
|
||||||
Location = new(ServerFlow.Size.X, 0, 0),
|
Location = new(ser.Size.X, 0, 0),
|
||||||
Size = new(Size.X - ServerFlow.Size.X, Size.Y),
|
Size = new(Size.X - ser.Size.X, Size.Y),
|
||||||
Anchor = ObjectAnchor.All
|
Anchor = ObjectAnchor.All
|
||||||
};
|
};
|
||||||
Controls.Add(SerBox);
|
Controls.Add(SerBox);
|
||||||
@ -461,54 +471,10 @@ public class MainScreenWindow : Window
|
|||||||
SerBox.Controls.Clear();
|
SerBox.Controls.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnKeyDown(KeyboardKeyEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnKeyDown(e);
|
|
||||||
if (e.Key == Keys.F9)
|
|
||||||
{
|
|
||||||
Globals.PrintParent(this);
|
|
||||||
}
|
|
||||||
else if (e.Key == Keys.F10)
|
|
||||||
{
|
|
||||||
CheckParent(this);
|
|
||||||
}
|
|
||||||
else if (e.Key == Keys.F12)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Update Time: " + UpdateAdverage);
|
|
||||||
Console.WriteLine("Draw Time: " + DrawAdverage);
|
|
||||||
Console.WriteLine("Total Time: " + TotalAdverage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void CheckParent(IParent p, IRenderObject c, int xx, Vector3i di)
|
|
||||||
{
|
|
||||||
if (p.IgnoreVisForChildren || p.Controls.Length <= 1 || xx >= p.Controls.Length || !c.Visible || c is ILabel) return;
|
|
||||||
for (int i = xx; i > 0; i--)
|
|
||||||
{
|
|
||||||
if (!p.Controls[i].IsVisible ||
|
|
||||||
((p.Controls[i].Location.X + di.X >= c.Location.X && p.Controls[i].Location.X + p.Controls[i].Size.X + di.X - c.Size.X <= c.Location.X) &&
|
|
||||||
(p.Controls[i].Location.Y + di.Y >= c.Location.Y && p.Controls[i].Location.Y + p.Controls[i].Size.Y + di.X - c.Size.Y <= c.Location.Y)))
|
|
||||||
{
|
|
||||||
p.Controls[i].NotifiNotVisible();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (p.Controls[i] is IParent pp) CheckParent(pp, c, pp.Controls.Length-1, di + p.Controls[i].Location);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void CheckParent(IParent p)
|
|
||||||
{
|
|
||||||
for (int i = p.Controls.Length - 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
CheckParent(p, p.Controls[i], i-1, new());
|
|
||||||
if (p.Controls[i] is IParent pp) CheckParent(pp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<Task> LoginOnChangeToApp()
|
private async Task<Task> LoginOnChangeToApp()
|
||||||
{
|
{
|
||||||
Controls.Clear();
|
Controls.Clear();
|
||||||
//ForceUpdate();
|
ForceUpdate();
|
||||||
BlockDraw = true;
|
BlockDraw = true;
|
||||||
Title = "Luski";
|
Title = "Luski";
|
||||||
unsafe
|
unsafe
|
||||||
@ -527,162 +493,55 @@ public class MainScreenWindow : Window
|
|||||||
WindowBorder = WindowBorder.Resizable;
|
WindowBorder = WindowBorder.Resizable;
|
||||||
BackgroundColor = new Color4(20, 20, 20, 255);
|
BackgroundColor = new Color4(20, 20, 20, 255);
|
||||||
|
|
||||||
Controls.Add(ServerFlow = new FlowLayout()
|
Controls.Add(ser = new FlowLayout()
|
||||||
{
|
{
|
||||||
BackgroundColor = new(26, 26, 26, 255),
|
BackgroundColor = new(26, 26, 26, 255),
|
||||||
Size = new(68.ScaleInt(), CS.Y),
|
Size = new(68.ScaleInt(), CS.Y),
|
||||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom,
|
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom,
|
||||||
Location = new(0,0,0)
|
Location = new(0,0,0)
|
||||||
});
|
});
|
||||||
ServerFlow.ForceDistanceUpdate(this);
|
ser.ForceDistanceUpdate(this);
|
||||||
ServerFlow.LoadToParent(this,this);
|
ser.LoadToParent(this,this);
|
||||||
DrawFrame();
|
DrawFrame();
|
||||||
|
DateTime utcNow = DateTime.UtcNow;
|
||||||
SerBox = new()
|
|
||||||
{
|
|
||||||
Location = new(ServerFlow.Size.X, 0, 0),
|
|
||||||
Size = new(Size.X - ServerFlow.Size.X, CS.Y),
|
|
||||||
Anchor = ObjectAnchor.All,
|
|
||||||
BackgroundColor = new(20, 20, 20, 255)
|
|
||||||
};
|
|
||||||
Controls.Add(SerBox);
|
|
||||||
SerBox.LoadToParent(this, this);
|
|
||||||
|
|
||||||
ServerTitle = new()
|
|
||||||
{
|
|
||||||
Size = new(307.ScaleInt(), 46.ScaleInt()),
|
|
||||||
BackgroundColor = new(30, 30, 30, 255)
|
|
||||||
};
|
|
||||||
SerBox.Controls.Add(ServerTitle);
|
|
||||||
|
|
||||||
|
|
||||||
ChannelSelector = new()
|
|
||||||
{
|
|
||||||
BackgroundColor = new(34, 34, 34, 255),
|
|
||||||
Location = new(0, ServerTitle.Size.Y +2.ScaleInt(), 0),
|
|
||||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom
|
|
||||||
};
|
|
||||||
ChannelSelector.Size = new(ServerTitle.Size.X, SerBox.Size.Y - 54.ScaleInt() - ChannelSelector.Location.Y);
|
|
||||||
SerBox.Controls.Add(ChannelSelector);
|
|
||||||
ChannelSelector.ForceDistanceUpdate(SerBox);
|
|
||||||
|
|
||||||
Console.WriteLine("Waiting");
|
|
||||||
Task.WhenAll(Globals.ServersLoading.ToArray()).Wait();
|
Task.WhenAll(Globals.ServersLoading.ToArray()).Wait();
|
||||||
Console.WriteLine("Done waiting");
|
|
||||||
foreach (PublicServer pser in Globals.Luski.LoadedServers)
|
foreach (PublicServer pser in Globals.Luski.LoadedServers)
|
||||||
{
|
{
|
||||||
ServerIcon<PublicServer> si = new ServerIcon<PublicServer>(pser);
|
ServerIcon<PublicServer> si = new ServerIcon<PublicServer>(pser);
|
||||||
ServerFlow.Controls.Add(si);
|
ser.Controls.Add(si);
|
||||||
si.LoadToParent(ServerFlow, this);
|
si.LoadToParent(ser, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (PublicServer pser in Globals.Luski.FailedServers)
|
foreach (PublicServer pser in Globals.Luski.FailedServers)
|
||||||
{
|
{
|
||||||
Console.WriteLine(pser.Name);
|
Console.WriteLine(pser.Name);
|
||||||
ServerIcon<PublicServer> si = new ServerIcon<PublicServer>(pser, true);
|
ServerIcon<PublicServer> si = new ServerIcon<PublicServer>(pser, true);
|
||||||
ServerFlow.Controls.Add(si);
|
ser.Controls.Add(si);
|
||||||
si.LoadToParent(ServerFlow, this);
|
si.LoadToParent(ser, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddServerIcon asi = new();
|
AddServerIcon asi = new();
|
||||||
asi.Clicked += AddButtonClicked;
|
asi.Clicked += AddButtonClicked;
|
||||||
ServerFlow.Controls.Add(asi);
|
ser.Controls.Add(asi);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ServerFlow.Controls.Length > 1) (ServerFlow.Controls[0] as ServerIcon<PublicServer>)!.LoadServer().Start();
|
if (ser.Controls.Length > 1) (ser.Controls[0] as ServerIcon<PublicServer>)!.LoadServer().Start();
|
||||||
DrawFrame();
|
DrawFrame();
|
||||||
MainShow += OnMainShow;
|
MainShow += OnMainShow;
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ForceUpdate()
|
|
||||||
{
|
|
||||||
DateTime dt = DateTime.Now;
|
|
||||||
BlockDraw = true;
|
|
||||||
for (int i = 0; i < Controls.Length; i++)
|
|
||||||
{
|
|
||||||
if (!Controls[i].Loaded) continue;
|
|
||||||
bool top = (Controls[i].Anchor & ObjectAnchor.Top) == ObjectAnchor.Top;
|
|
||||||
bool left = (Controls[i].Anchor & ObjectAnchor.Left) == ObjectAnchor.Left;
|
|
||||||
bool right = (Controls[i].Anchor & ObjectAnchor.Right) == ObjectAnchor.Right;
|
|
||||||
bool bottom = (Controls[i].Anchor & ObjectAnchor.Bottom) == ObjectAnchor.Bottom;
|
|
||||||
if (!top && !bottom) { Controls[i].Anchor |= ObjectAnchor.Top; top = true; }
|
|
||||||
if (!left && !right) { Controls[i].Anchor |= ObjectAnchor.Left; left = true; }
|
|
||||||
|
|
||||||
int lx, ly, sy, sx;
|
|
||||||
bool UpdateDistance = false;
|
|
||||||
if ((Controls[i].Anchor & ObjectAnchor.PreventWidthChange) == ObjectAnchor.PreventWidthChange)
|
|
||||||
{
|
|
||||||
UpdateDistance = true;
|
|
||||||
lx = Controls[i].Location.X + ((CS.X - Controls[i].Distance.X - Controls[i].Size.X - Controls[i].Location.X) / 2);
|
|
||||||
sx = Controls[i].Size.X;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lx = (left ? Controls[i].Location.X : CS.X - Controls[i].Distance.X - Controls[i].Size.X);
|
|
||||||
sx = (right ? CS.X - Controls[i].Distance.X - lx : Controls[i].Size.X);
|
|
||||||
}
|
|
||||||
if ((Controls[i].Anchor & ObjectAnchor.PreventHeightChange) == ObjectAnchor.PreventHeightChange)
|
|
||||||
{
|
|
||||||
UpdateDistance = true;
|
|
||||||
ly = Controls[i].Location.Y + ((CS.Y - Controls[i].Distance.Y - Controls[i].Size.Y - Controls[i].Location.Y) / 2);
|
|
||||||
sy = Controls[i].Size.Y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ly = (top ? Controls[i].Location.Y : CS.Y - Controls[i].Distance.Y - Controls[i].Size.Y);
|
|
||||||
sy = (bottom ? CS.Y - Controls[i].Distance.Y - ly : Controls[i].Size.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
Controls[i].SetSize(sx, sy);
|
|
||||||
Controls[i].SetLocation(lx, ly);
|
|
||||||
if (UpdateDistance)
|
|
||||||
{
|
|
||||||
Controls[i].ForceDistanceUpdate(this);
|
|
||||||
}
|
|
||||||
if (Controls[i] is IParent parent)
|
|
||||||
{
|
|
||||||
parent.ParentResize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (UpdateAdverage is null) UpdateAdverage = DateTime.Now - dt;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateAdverage = new((UpdateAdverage.Value.Ticks + (DateTime.Now - dt).Ticks)/2);
|
|
||||||
}
|
|
||||||
DateTime dtt = DateTime.Now;
|
|
||||||
DrawFrame();
|
|
||||||
if (DrawAdverage is null || TotalAdverage is null)
|
|
||||||
{
|
|
||||||
DrawAdverage = DateTime.Now - dtt;
|
|
||||||
TotalAdverage = DateTime.Now - dt;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DrawAdverage = new((DrawAdverage.Value.Ticks + (DateTime.Now - dtt).Ticks)/2);
|
|
||||||
TotalAdverage = new((TotalAdverage.Value.Ticks + (DateTime.Now - dt).Ticks)/2);
|
|
||||||
}
|
|
||||||
BlockDraw = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TimeSpan? UpdateAdverage, DrawAdverage, TotalAdverage;
|
|
||||||
|
|
||||||
|
|
||||||
private Task AddButtonClicked(IRenderObject arg)
|
private Task AddButtonClicked(IRenderObject arg)
|
||||||
{
|
{
|
||||||
CenterFullScreenBase aso = new(new AddServerOverlayForm())
|
AddServerOverlay aso = new();
|
||||||
{
|
|
||||||
AllowHoverFromBehind = false
|
|
||||||
};
|
|
||||||
//AddServerOverlayld aso = new();
|
|
||||||
aso.Clicked += AsoOnClicked;
|
aso.Clicked += AsoOnClicked;
|
||||||
Controls.Add(aso);
|
Controls.Add(aso);
|
||||||
|
|
||||||
aso.LoadToParent(this, this);
|
TryDraw();
|
||||||
GL.Scissor(0,0, CS.X, CS.Y);
|
OnResize(new(CS));
|
||||||
aso.Draw(0,0,0,0, CS.X, CS.Y);
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -691,8 +550,7 @@ public class MainScreenWindow : Window
|
|||||||
{
|
{
|
||||||
Globals.ms.Controls.Remove(arg);
|
Globals.ms.Controls.Remove(arg);
|
||||||
Globals.ms.DrawFrame();
|
Globals.ms.DrawFrame();
|
||||||
CenterFullScreenBase aso = (arg as CenterFullScreenBase)!;
|
AddServerOverlay aso = (arg as AddServerOverlay)!;
|
||||||
//AddServerOverlayld aso = (arg as AddServerOverlayld)!;
|
|
||||||
aso.Clicked -= AsoOnClicked;
|
aso.Clicked -= AsoOnClicked;
|
||||||
aso.Clean();
|
aso.Clean();
|
||||||
aso = null!;
|
aso = null!;
|
||||||
|
110
Luski/Globals.cs
110
Luski/Globals.cs
@ -110,7 +110,7 @@ public static class Globals
|
|||||||
for (int i = 0; i < p.Controls.Length; i++)
|
for (int i = 0; i < p.Controls.Length; i++)
|
||||||
{
|
{
|
||||||
if (p.Controls[i].IgnoreHover) continue;
|
if (p.Controls[i].IgnoreHover) continue;
|
||||||
Console.WriteLine(sp + p.Controls[i] + ": " + p.Controls[i].IsVisible + " " + p.Controls[i].Location + " " + (p.Controls[i].Location + l) + " "+ p.Controls[i].Size);
|
Console.WriteLine(sp + p.Controls[i] + ": " + p.Controls[i].Location + " " + (p.Controls[i].Location + l) + " "+ p.Controls[i].Size);
|
||||||
if (p.Controls[i] is IParent pp) PrintP(index + 1, pp, l + pp.Position);
|
if (p.Controls[i] is IParent pp) PrintP(index + 1, pp, l + pp.Position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,7 +319,7 @@ public static class Globals
|
|||||||
|
|
||||||
public static UserControl AddNumberSlider<TNumber>(IParent parent, string Name, string description, TNumber defaul, TNumber min, TNumber val, TNumber max, Action<TNumber> a) where TNumber : INumber<TNumber>
|
public static UserControl AddNumberSlider<TNumber>(IParent parent, string Name, string description, TNumber defaul, TNumber min, TNumber val, TNumber max, Action<TNumber> a) where TNumber : INumber<TNumber>
|
||||||
{
|
{
|
||||||
NumberSelector<TNumber> NumberSelector = new()
|
NumberSelector<TNumber> ts = new()
|
||||||
{
|
{
|
||||||
Default = defaul,
|
Default = defaul,
|
||||||
Min = min,
|
Min = min,
|
||||||
@ -348,105 +348,24 @@ public static class Globals
|
|||||||
Text = description
|
Text = description
|
||||||
});
|
});
|
||||||
tc.Size = l.Size;
|
tc.Size = l.Size;
|
||||||
tc.Controls.Add(NumberSelector);
|
|
||||||
NumberSelector.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space, 0);
|
|
||||||
|
|
||||||
Rectangle TempLine = new()
|
|
||||||
{
|
|
||||||
Location = new(0, NumberSelector.Location.Y + NumberSelector.Size.Y + space, 0),
|
|
||||||
BackgroundColor = Color4.White,
|
|
||||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top
|
|
||||||
};
|
|
||||||
l.Tag = TempLine;
|
|
||||||
TempLine.Size = new(parent.Size.X - space - space, 2.ScaleInt());
|
|
||||||
tc.SetSize(parent.Size.X, TempLine.Location.Y + TempLine.Size.Y);
|
|
||||||
NumberSelector.SetSize(TempLine.Size.X, 0);
|
|
||||||
NumberSelector.SetLocation(TempLine.Location.X, NumberSelector.Location.Y);
|
|
||||||
NumberSelector.ForceDistanceUpdate(tc);
|
|
||||||
TempLine.ForceDistanceUpdate(tc);
|
|
||||||
tc.Controls.Add(TempLine);
|
|
||||||
NumberSelector.ValueChanged += @switch =>
|
|
||||||
{
|
|
||||||
a.Invoke(@switch.Value);
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
tc.ForceDistanceUpdate(parent);
|
|
||||||
parent.Controls.Add(tc);
|
|
||||||
return tc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UserControl AddNullNumberSlider<TNumber>(IParent parent, string Name, string description, TNumber defaul, TNumber min, TNumber? val, TNumber max, Action<TNumber?> a) where TNumber : struct, INumber<TNumber>
|
|
||||||
{
|
|
||||||
TNumber v = defaul;
|
|
||||||
if (val is not null) v = val.Value;
|
|
||||||
ToggleSwitch ts = new()
|
|
||||||
{
|
|
||||||
Value = val is not null,
|
|
||||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Right
|
|
||||||
};
|
|
||||||
NumberSelector<TNumber> NumberSelector = new()
|
|
||||||
{
|
|
||||||
Default = defaul,
|
|
||||||
Min = min,
|
|
||||||
Max = max,
|
|
||||||
Value = v,
|
|
||||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Right | ObjectAnchor.Left,
|
|
||||||
BackgroundColor = new(0,0,0,0),
|
|
||||||
Space = 10.ScaleInt()
|
|
||||||
};
|
|
||||||
UserControl tc = new()
|
|
||||||
{
|
|
||||||
BackgroundColor = new(0,0,0,0)
|
|
||||||
};
|
|
||||||
Label l, ll;
|
|
||||||
int space = 5.ScaleInt();
|
|
||||||
tc.Controls.Add(ll =new Label(Globals.DefaultFont)
|
|
||||||
{
|
|
||||||
Location = new(0, space + space, 0),
|
|
||||||
Text = Name
|
|
||||||
});
|
|
||||||
tc.Controls.Add(l =new Label(Globals.DefaultFont)
|
|
||||||
{
|
|
||||||
Location = new(ll.Location.X, ll.Size.Y + space, 0),
|
|
||||||
Color = Color4.Gray,
|
|
||||||
MaxSize = parent.Size,
|
|
||||||
Text = description
|
|
||||||
});
|
|
||||||
tc.Size = l.Size;
|
|
||||||
tc.Controls.Add(ts);
|
tc.Controls.Add(ts);
|
||||||
ts.Location = new(parent.Size.X - ts.Size.X - 5.ScaleInt(), ll.Location.Y, 0);
|
ts.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space, 0);
|
||||||
tc.Controls.Add(NumberSelector);
|
|
||||||
NumberSelector.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space, 0);
|
|
||||||
|
|
||||||
Rectangle TempLine = new()
|
Rectangle TempLine = new()
|
||||||
{
|
{
|
||||||
Location = new(0, NumberSelector.Location.Y + NumberSelector.Size.Y + space, 0),
|
Location = new(0, ts.Location.Y + ts.Size.Y + space, 0),
|
||||||
BackgroundColor = Color4.White,
|
BackgroundColor = Color4.White,
|
||||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top
|
Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Top
|
||||||
};
|
};
|
||||||
l.Tag = TempLine;
|
l.Tag = TempLine;
|
||||||
TempLine.Size = new(parent.Size.X - space - space, 2.ScaleInt());
|
TempLine.Size = new(parent.Size.X - space - space, 2.ScaleInt());
|
||||||
tc.SetSize(parent.Size.X, TempLine.Location.Y + TempLine.Size.Y);
|
tc.SetSize(parent.Size.X, TempLine.Location.Y + TempLine.Size.Y);
|
||||||
NumberSelector.SetSize(TempLine.Size.X, 0);
|
ts.SetSize(TempLine.Size.X - 10.ScaleInt(), 0);
|
||||||
NumberSelector.SetLocation(TempLine.Location.X, NumberSelector.Location.Y);
|
ts.SetLocation(TempLine.Location.X, ts.Location.Y);
|
||||||
NumberSelector.ForceDistanceUpdate(tc);
|
ts.ForceDistanceUpdate(tc);
|
||||||
TempLine.ForceDistanceUpdate(tc);
|
TempLine.ForceDistanceUpdate(tc);
|
||||||
tc.Controls.Add(TempLine);
|
tc.Controls.Add(TempLine);
|
||||||
ts.ForceDistanceUpdate(tc);
|
|
||||||
ts.ValueChanged += @switch =>
|
ts.ValueChanged += @switch =>
|
||||||
{
|
|
||||||
if (@switch.Value)
|
|
||||||
{
|
|
||||||
a.Invoke(defaul);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NumberSelector.Value = defaul;
|
|
||||||
a.Invoke(null);
|
|
||||||
}
|
|
||||||
return Task.CompletedTask;
|
|
||||||
};
|
|
||||||
NumberSelector.ValueChanged += @switch =>
|
|
||||||
{
|
{
|
||||||
a.Invoke(@switch.Value);
|
a.Invoke(@switch.Value);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
@ -493,20 +412,7 @@ public static class Globals
|
|||||||
t.GetCustomAttributes(typeof(Luski.Shared.GlobalAttributes.DisplayNameAttribute), false);
|
t.GetCustomAttributes(typeof(Luski.Shared.GlobalAttributes.DisplayNameAttribute), false);
|
||||||
if (namevalueAttributes.Length == 0) return;
|
if (namevalueAttributes.Length == 0) return;
|
||||||
string Name = ((Luski.Shared.GlobalAttributes.DisplayNameAttribute)namevalueAttributes[0]).DisplayName;
|
string Name = ((Luski.Shared.GlobalAttributes.DisplayNameAttribute)namevalueAttributes[0]).DisplayName;
|
||||||
_ = AddNumberSlider(parent, Name, description, t.GetAnyAttribute<NumberDefault<TNumber>>().Default, t.GetAnyAttribute<NumberMin<TNumber>>().Min, s, t.GetAnyAttribute<NumberMax<TNumber>>().Max,a);
|
AddNumberSlider(parent, Name, description, t.GetAnyAttribute<NumberDefault<TNumber>>().Default, t.GetAnyAttribute<NumberMin<TNumber>>().Min, s, t.GetAnyAttribute<NumberMax<TNumber>>().Max,a);
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddNullNumberSlider<TNumber>(IParent parent, PropertyInfo t, TNumber? s, Action<TNumber?> a) where TNumber : struct, INumber<TNumber>
|
|
||||||
{
|
|
||||||
object[] valueAttributes =
|
|
||||||
t.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
|
||||||
if (valueAttributes.Length == 0) return;
|
|
||||||
string description = ((DescriptionAttribute)valueAttributes[0]).Description;
|
|
||||||
object[] namevalueAttributes =
|
|
||||||
t.GetCustomAttributes(typeof(Luski.Shared.GlobalAttributes.DisplayNameAttribute), false);
|
|
||||||
if (namevalueAttributes.Length == 0) return;
|
|
||||||
string Name = ((Luski.Shared.GlobalAttributes.DisplayNameAttribute)namevalueAttributes[0]).DisplayName;
|
|
||||||
_ = AddNullNumberSlider(parent, Name, description, t.GetAnyAttribute<NumberDefault<TNumber>>().Default, t.GetAnyAttribute<NumberMin<TNumber>>().Min, s, t.GetAnyAttribute<NumberMax<TNumber>>().Max,a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TAttribute GetAnyAttribute<TAttribute>(this PropertyInfo t)
|
public static TAttribute GetAnyAttribute<TAttribute>(this PropertyInfo t)
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="GraphicsManager" Version="1.1.0-alpha98" />
|
<PackageReference Include="GraphicsManager" Version="1.1.0-alpha68" />
|
||||||
<PackageReference Include="Luski.net" Version="2.0.1-alpha18" />
|
<PackageReference Include="Luski.net" Version="2.0.1-alpha17" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using GraphicsManager;
|
||||||
|
using GraphicsManager.Enums;
|
||||||
|
using GraphicsManager.Objects.Core;
|
||||||
using Luski;
|
using Luski;
|
||||||
using Luski.Classes;
|
using Luski.Classes;
|
||||||
using Luski.GUI;
|
using Luski.GUI;
|
||||||
|
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||||
|
using OpenTK.Mathematics;
|
||||||
using OpenTK.Windowing.Common.Input;
|
using OpenTK.Windowing.Common.Input;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp.PixelFormats;
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
@ -50,7 +55,6 @@ try
|
|||||||
switch (server.Main)
|
switch (server.Main)
|
||||||
{
|
{
|
||||||
case false:
|
case false:
|
||||||
// if (server.Domain == "jt.luskiserver.jacobtech.com") continue;
|
|
||||||
Globals.ServersLoading.Add(Task.Run(async () =>
|
Globals.ServersLoading.Add(Task.Run(async () =>
|
||||||
{
|
{
|
||||||
return await Globals.Luski.TryGetPublicServer(out _, server.Domain, server.Version,
|
return await Globals.Luski.TryGetPublicServer(out _, server.Domain, server.Version,
|
||||||
@ -77,7 +81,7 @@ try
|
|||||||
MainScreenWindow.Settings.Icon = Globals.Icon;
|
MainScreenWindow.Settings.Icon = Globals.Icon;
|
||||||
Globals.ms = new MainScreenWindow();
|
Globals.ms = new MainScreenWindow();
|
||||||
Globals.ms.CustomF11 = false;
|
Globals.ms.CustomF11 = false;
|
||||||
//Globals.ms.DrawFrame();
|
Globals.ms.DrawFrame();
|
||||||
pixels = Array.Empty<byte>();
|
pixels = Array.Empty<byte>();
|
||||||
Globals.ms.StartRender();
|
Globals.ms.StartRender();
|
||||||
Globals.ms.Dispose();
|
Globals.ms.Dispose();
|
||||||
|
Loading…
Reference in New Issue
Block a user