ummm
look at all the code
This commit is contained in:
Luski
Classes
GUI
MainScreen
UI
AccountButton.csAddServerIcon.csAddServerOverlayForm.csAddServerOverlayld.cs
Generic
LuskiControls
AdvancedGradientLabel.csBasicGradientLabel.csCenterFullScreenBase.csCompressedFlow.csDropDown.csLuskiLabel.csMessageCompressedFlow.csNumberSelector.csProfileView.csServerFlow.cs
ServerForms
SettingsMenuBase
TextBox.csToggleSwitch.csUserView.csVersionDropButton.csLuskiSettings
PublicServers
ServerIcon.csServerLoginOverlay.csSettingsPanel
Interfaces
Luski.csprojLuski.icoNew
Program.cs@ -15,8 +15,8 @@ public class Settings
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("scale")]
|
||||
[SettingInfo(SettingGroup.AppSettings, SettingsPage.Appearance)]
|
||||
[Shared.GlobalAttributes.DisplayName("Message Font Size")]
|
||||
[Description("Sets the px value for the message font size")]
|
||||
[Shared.GlobalAttributes.DisplayName("App Scale")]
|
||||
[Description("Sets the scale for the app. If disabled, the default system scale will be used.")]
|
||||
[NumberSelector(typeof(double?))]
|
||||
[NumberMin<double>(0.25)]
|
||||
[NumberDefault<double>(1)]
|
||||
@ -81,12 +81,12 @@ public class Settings
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ScaleFonts;
|
||||
return _ScaleFonts && Scale is not null;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ScaleFonts = value;
|
||||
if (Globals.ms is not null)
|
||||
if (Globals.RootWindow is not null)
|
||||
{
|
||||
Globals.DefaultFont.PixelHeight = Globals.Settings.DefaultFontPX.ScaleFont();
|
||||
Globals.MessageFont.PixelHeight = Globals.Settings.MessageFontPX.ScaleFont();
|
||||
@ -97,8 +97,8 @@ public class Settings
|
||||
Label._characters[Globals.ms.Context][Globals.TopTimeFont].Clear();
|
||||
Label._characters[Globals.ms.Context][Globals.SmallTimeFont].Clear();
|
||||
|
||||
Globals.ms.ForceUpdate();
|
||||
Globals.ms.DrawFrame();
|
||||
Globals.RootWindow.ForceUpdate();
|
||||
Globals.RootWindow.DrawFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class AccountButton : UserControl
|
||||
};
|
||||
}
|
||||
|
||||
private async Task OnClicked(IRenderObject arg)
|
||||
private async Task OnClicked(RenderObjectCore arg)
|
||||
{
|
||||
if (!Selected) await ToggleSelected();
|
||||
}
|
||||
@ -67,7 +67,7 @@ public class AccountButton : UserControl
|
||||
f = Color4.Gray;
|
||||
}
|
||||
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
Selected = !Selected;
|
||||
|
||||
if (SM.Selected is not null && SM.Selected != this)
|
||||
@ -84,7 +84,7 @@ public class AccountButton : UserControl
|
||||
Globals.ms.ForceUpdate();
|
||||
}
|
||||
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
TryDraw();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using OpenTK.Mathematics;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI;
|
||||
|
@ -171,7 +171,7 @@ public class AddServerOverlayForm : UserControl
|
||||
version.DropDownContainer.BackgroundColor = version.BackgroundColor;
|
||||
version.OpenStatusChanged += b =>
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
if (b)
|
||||
{
|
||||
version.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangleTop.png");
|
||||
@ -181,7 +181,7 @@ public class AddServerOverlayForm : UserControl
|
||||
version.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png");
|
||||
}
|
||||
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
@ -216,7 +216,7 @@ public class AddServerOverlayForm : UserControl
|
||||
|
||||
public override void ParentResize()
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
for (int i = 0; i < Controls.Length; i++)
|
||||
{
|
||||
if (!Controls[i].Loaded) continue;
|
||||
@ -278,6 +278,6 @@ public class AddServerOverlayForm : UserControl
|
||||
}
|
||||
}
|
||||
if (Parent is not null) Parent.TryDraw();
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.Classes;
|
||||
@ -9,7 +8,7 @@ using Luski.net;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using OpenTK.Mathematics;
|
||||
using OpenTK.Windowing.GraphicsLibraryFramework;
|
||||
using Rectangle = GraphicsManager.Objects.Rectangle;
|
||||
using Rectangle = GraphicsManager.Objects.Core.Rectangle;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI;
|
||||
|
||||
@ -161,7 +160,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
version.DropDownContainer.BackgroundColor = version.BackgroundColor;
|
||||
version.OpenStatusChanged += b =>
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
if (b)
|
||||
{
|
||||
version.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangleTop.png");
|
||||
@ -171,7 +170,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
version.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png");
|
||||
}
|
||||
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
@ -520,7 +519,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
btn.Clicked += BtnOnClicked;
|
||||
}
|
||||
|
||||
private async Task BtnOnClicked(IRenderObject arg)
|
||||
private async Task BtnOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
if (btn.Textures[0].handel == Globals.ms.TextureManager.GetTextureResource("BadTextbox.png").handel)
|
||||
return;
|
||||
@ -596,7 +595,7 @@ public class AddServerOverlayld : UserControl, IServerOverlay
|
||||
|
||||
private string pfp = "";
|
||||
|
||||
private Task RecOnFilesDroped(IRenderObject obj, string[] arg)
|
||||
private Task RecOnFilesDroped(RenderObjectCore obj, string[] arg)
|
||||
{
|
||||
Console.WriteLine(arg[0]);
|
||||
if (!arg[0].ToLower().EndsWith("png")) return Task.CompletedTask;
|
||||
|
@ -72,9 +72,9 @@ public class Category : UserControl, IChannelAdder
|
||||
private Category()
|
||||
{
|
||||
}
|
||||
private async Task TmpOnClicked(IRenderObject arg)
|
||||
private async Task TmpOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
if (!Extended)
|
||||
{
|
||||
DateTime dt = DateTime.UtcNow;
|
||||
@ -83,7 +83,7 @@ public class Category : UserControl, IChannelAdder
|
||||
foreach (SocketChannel v in Channels)
|
||||
{
|
||||
Channel c = await AddChannel(v);
|
||||
c.LoadToParent(Members, Window!);
|
||||
// c.LoadToParent(Members, Window!);
|
||||
_ = CatOnAddY(c.Size.Y);
|
||||
}
|
||||
Console.WriteLine(DateTime.UtcNow - dt);
|
||||
@ -93,7 +93,7 @@ public class Category : UserControl, IChannelAdder
|
||||
foreach (SocketCategory v in cats)
|
||||
{
|
||||
var c = await AddCategory(v, dt);
|
||||
c.LoadToParent(Members, Window!);
|
||||
//c.LoadToParent(Members, Window!);
|
||||
_ = CatOnAddY(c.Size.Y);
|
||||
}
|
||||
Console.WriteLine(DateTime.UtcNow - dt);
|
||||
@ -106,8 +106,7 @@ public class Category : UserControl, IChannelAdder
|
||||
//Members.Controls.Clear(false);
|
||||
}
|
||||
|
||||
BlockDraw = false;
|
||||
|
||||
RemoveBlockDraw();
|
||||
Extended = !Extended;
|
||||
|
||||
// Window!.ForceUpdate(new(Window.Size));
|
||||
@ -133,7 +132,7 @@ public class Category : UserControl, IChannelAdder
|
||||
}
|
||||
}
|
||||
|
||||
private Task AllOnClicked(IRenderObject arg)
|
||||
private Task AllOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
if (ClickCon is not null) _ = ClickCon.Invoke(this);
|
||||
return Task.CompletedTask;
|
||||
|
@ -89,7 +89,7 @@ public class Channel : UserControl
|
||||
bc = CS.BackgroundColor;
|
||||
}
|
||||
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
Selected = !Selected;
|
||||
|
||||
if (CS.Selected is not null && CS.Selected != this)
|
||||
@ -118,7 +118,7 @@ public class Channel : UserControl
|
||||
else Globals.ms.ChatBoxArea.MessageFlow.ScrollToTop();
|
||||
Console.WriteLine("Done");
|
||||
}
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
TryDraw();
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -137,20 +137,20 @@ public class Channel : UserControl
|
||||
return c;
|
||||
}
|
||||
|
||||
private Task EditChannelButtonOnClicked(IRenderObject arg)
|
||||
private Task EditChannelButtonOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
arg.ContextMenu!.HideContext(Window!);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task ExportKeysButtonOnClicked(IRenderObject arg)
|
||||
private Task ExportKeysButtonOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
//_ = CurrentChannel.SendKeysToUsers(CancellationToken.None);
|
||||
ContextMenu!.HideContext(Window!);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task AllOnClicked(IRenderObject arg)
|
||||
private async Task AllOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
if (!Selected) await ToggleSelected();
|
||||
//if (ClickCon is not null) _ = ClickCon.Invoke(this);
|
||||
|
@ -1,5 +1,6 @@
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.GUI.MainScreen.Interfaces;
|
||||
using Luski.GUI.MainScreen.UI.PublicServers;
|
||||
using Luski.net.Structures.Public;
|
||||
@ -15,55 +16,6 @@ public class ChannelSelector : FlowLayout, IChannelAdder
|
||||
private readonly List<Channel> LoadedChannels = new();
|
||||
public Dictionary<long, IChannelAdder> ChannelAdders = new();
|
||||
public Channel? Selected;
|
||||
|
||||
public override void ResizeDraw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
{
|
||||
if (OldHeight == Size.Y)
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
else if (OldHeight < Size.Y)
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, OldWidth, OldHeight, x, y);
|
||||
int nsh = sh - OldHeight+1;
|
||||
if (nsh <= 0) return;
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, nsh);
|
||||
DrawBase();
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
|
||||
|
||||
for (int i = 0; i < Controls.Length; i++)
|
||||
{
|
||||
if (!Controls[i].Loaded)
|
||||
{
|
||||
BlockDraw = true;
|
||||
Controls[i].LoadToParent(this, Window!);
|
||||
BlockDraw = false;
|
||||
}
|
||||
if (Controls[i].Location.X >= Size.X ||
|
||||
Controls[i].Location.Y >= Size.Y ||
|
||||
Controls[i].Location.X + Controls[i].Size.X < OldWidth ||
|
||||
Controls[i].Location.Y + Controls[i].Size.Y < OldHeight) continue;
|
||||
|
||||
|
||||
if (Controls[i] is IParent pp)
|
||||
{
|
||||
pp.ResizeDraw(x,y,sx,sy,sw,sh);
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
|
||||
}
|
||||
else
|
||||
{
|
||||
Controls[i].Draw(x,y,sx,sy,sw,sh);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task LoadSelectorRoot(SocketCategory Cat)
|
||||
{
|
||||
@ -89,13 +41,13 @@ public class ChannelSelector : FlowLayout, IChannelAdder
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RLOnClicked(IRenderObject arg)
|
||||
private async Task RLOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
Globals.ms.Controls.Add(new AddChannel(this, CurrentCategory));
|
||||
TryDraw();
|
||||
}
|
||||
|
||||
private async Task LOnClicked(IRenderObject arg)
|
||||
private async Task LOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
Globals.ms.Controls.Add(new AddChannel(this, CurrentCategory));
|
||||
TryDraw();
|
||||
|
@ -1,6 +1,7 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using OpenTK.Mathematics;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.Generic;
|
||||
@ -9,7 +10,7 @@ public class LuskiFlow : FlowLayout
|
||||
{
|
||||
public override void ParentResize()
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
for (int i = 0; i < Controls.Length; i++)
|
||||
{
|
||||
if (Controls[i] is IParent parent)
|
||||
@ -18,12 +19,12 @@ public class LuskiFlow : FlowLayout
|
||||
}
|
||||
}
|
||||
if (Parent is not null) Parent.TryDraw();
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
}
|
||||
|
||||
public override void ReportSizeUpdate(IRenderObject Control)
|
||||
public override void ReportSizeUpdate(RenderObjectCore Control)
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
int index = Controls.IndexOf(Control);
|
||||
if (index < Controls.Length - 1)
|
||||
{
|
||||
@ -42,6 +43,6 @@ public class LuskiFlow : FlowLayout
|
||||
{
|
||||
ForceScrollUpdate();
|
||||
}
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
}
|
||||
}
|
@ -6,60 +6,4 @@ namespace Luski.GUI.MainScreen.UI.Generic;
|
||||
|
||||
public class MessageFlow : LuskiFlow
|
||||
{
|
||||
public override void ResizeDraw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
{
|
||||
if (LuskiExperiments.GUI.LiveLabelSize.IsEnabled())
|
||||
{
|
||||
if (OldHeight == Size.Y)
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
else if (OldHeight < Size.Y && OldWidth < Size.X)
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, OldWidth, OldHeight, x, y);
|
||||
int nsh = sh - OldHeight+1;
|
||||
if (nsh <= 0) return;
|
||||
int nsw = sw - OldWidth+1;
|
||||
if (nsw <= 0) return;
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, nsh);
|
||||
DrawBase();
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, nsw, sh);
|
||||
DrawBase();
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
|
||||
|
||||
for (int i = 0; i < Controls.Length; i++)
|
||||
{
|
||||
if (!Controls[i].Loaded)
|
||||
{
|
||||
BlockDraw = true;
|
||||
Controls[i].LoadToParent(this, Window!);
|
||||
BlockDraw = false;
|
||||
}
|
||||
if (Controls[i].Location.X >= Size.X ||
|
||||
Controls[i].Location.Y >= Size.Y ||
|
||||
Controls[i].Location.X + Controls[i].Size.X < OldWidth ||
|
||||
Controls[i].Location.Y + Controls[i].Size.Y < OldHeight) continue;
|
||||
|
||||
|
||||
if (Controls[i] is IParent pp)
|
||||
{
|
||||
pp.ResizeDraw(x,y,sx,sy,sw,sh);
|
||||
GL.Scissor(sx, Window!.CS.Y - sy - sh, sw, sh);
|
||||
}
|
||||
else
|
||||
{
|
||||
Controls[i].Draw(x,y,sx,sy,sw,sh);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
}
|
||||
else base.ResizeDraw(x,y,sx,sy,sw,sh);
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
using GraphicsManager.Structs;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using OpenTK.Mathematics;
|
||||
@ -8,9 +9,18 @@ namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
|
||||
public class AdvancedGradientLabel : LabelBase
|
||||
{
|
||||
public AdvancedGradientLabel(FontInteraction fi) : base(fi) { }
|
||||
public AdvancedGradientLabel(FontInteraction fi) : base(fi)
|
||||
{
|
||||
WindowLoaded += OnWindowLoaded;
|
||||
}
|
||||
|
||||
public Color4[] Colors { get; set; } = new[]
|
||||
private Task OnWindowLoaded(RenderObjectCore arg)
|
||||
{
|
||||
Shader = Globals.GradientShader[Window!.Context];
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Color4[] Colors { get; set; } = new[]
|
||||
{
|
||||
new Color4(255, 255, 255, 255),
|
||||
new Color4(255, 255, 255, 255)
|
||||
@ -41,14 +51,7 @@ public class AdvancedGradientLabel : LabelBase
|
||||
|
||||
return new Color4(r, g, b, a);
|
||||
}
|
||||
public override void LoadToParent(IParent window, IWindow win)
|
||||
{
|
||||
if (Loaded) return;
|
||||
if (Shader is null) Shader = Globals.GradientShader[win.Context];
|
||||
base.LoadToParent(window, win);
|
||||
}
|
||||
|
||||
public override void Draw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
public override void DrawSelf()
|
||||
{
|
||||
if (Visible && Loaded && this.Font is not null && Colors.Length > 1)
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
using GraphicsManager.Structs;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using OpenTK.Mathematics;
|
||||
|
@ -1,13 +1,13 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
|
||||
public class CenterFullScreenBase : UserControl
|
||||
{
|
||||
private IRenderObject centerobj;
|
||||
public CenterFullScreenBase(IRenderObject obj, bool Streach = false)
|
||||
private RenderObjectCore centerobj;
|
||||
public CenterFullScreenBase(RenderObjectCore obj, bool Streach = false)
|
||||
{
|
||||
centerobj = obj;
|
||||
if (!Streach) obj.Anchor = ObjectAnchor.Prevent;
|
||||
@ -15,13 +15,14 @@ public class CenterFullScreenBase : UserControl
|
||||
Controls.Add(obj);
|
||||
base.BackgroundColor = new(0, 0, 0, 130);
|
||||
Anchor = ObjectAnchor.All;
|
||||
WindowLoaded += OnWindowLoaded;
|
||||
}
|
||||
|
||||
public override void LoadToParent(IParent p, IWindow w)
|
||||
private Task OnWindowLoaded(RenderObjectCore arg)
|
||||
{
|
||||
base.SetSize(w.CS.X, w.CS.Y);
|
||||
centerobj.SetLocation((w.CS.X - centerobj.Size.X)/2, (w.CS.Y - centerobj.Size.Y)/2);
|
||||
base.SetSize(Window!.CS.X, Window!.CS.Y);
|
||||
centerobj.SetLocation((Window!.CS.X - centerobj.Size.X)/2, (Window!.CS.Y - centerobj.Size.Y)/2);
|
||||
centerobj.ForceDistanceUpdate(this);
|
||||
base.LoadToParent(p, w);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.GUI.MainScreen.UI.PublicServers;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using OpenTK.Mathematics;
|
||||
@ -17,14 +18,14 @@ public class CompressedFlow : UserControl
|
||||
ChildPadding = new(Padding.X);
|
||||
}
|
||||
|
||||
public event Func<IRenderObject, Task>? SizeUpdateNotIgnored;
|
||||
public event Func<RenderObjectCore, Task>? SizeUpdateNotIgnored;
|
||||
|
||||
public Vector4i Padding { get; set; }
|
||||
public Vector2i ChildPadding { get; set; }
|
||||
|
||||
private bool IgnoreNextSizeChange;
|
||||
|
||||
private Task OnSizeChanged(IRenderObject arg)
|
||||
private Task OnSizeChanged(RenderObjectCore arg)
|
||||
{
|
||||
if (IgnoreNextSizeChange)
|
||||
{
|
||||
@ -41,7 +42,7 @@ public class CompressedFlow : UserControl
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task ControlsOnControlAdded(int arg1, IRenderObject arg2)
|
||||
private Task ControlsOnControlAdded(int arg1, RenderObjectCore arg2)
|
||||
{
|
||||
if (arg1 != 0)
|
||||
{
|
||||
|
@ -23,44 +23,12 @@ public class DropDown<TSelection> : UserControl where TSelection : DropDownOptio
|
||||
set
|
||||
{
|
||||
ip = value;
|
||||
DropDownContainer.TransferOwners(Globals.ms, value);
|
||||
DropDownContainer.TransferOwners(Globals.RootWindow, value);
|
||||
}
|
||||
}
|
||||
private bool IsOpen;
|
||||
public event Func<bool, Task>? OpenStatusChanged;
|
||||
|
||||
public DropDown(TSelection defaultOption)
|
||||
{
|
||||
ip = this;
|
||||
DropDownContainer = new()
|
||||
{
|
||||
Visible = false
|
||||
};
|
||||
Clicked += OnClicked;
|
||||
WindowLoaded += OnWindowLoaded;
|
||||
AddOption(defaultOption);
|
||||
SelectedOption = defaultOption;
|
||||
}
|
||||
|
||||
public DropDown(Texture t, TSelection defaultOption)
|
||||
:base(t)
|
||||
{
|
||||
ip = this;
|
||||
TextureDisplay = TextureDisplay.HorizontalCenter;
|
||||
DropDownContainer = new()
|
||||
{
|
||||
Visible = false,
|
||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Top | ObjectAnchor.Right
|
||||
};
|
||||
Clicked += OnClicked;
|
||||
WindowLoaded += OnWindowLoaded;
|
||||
DropDownContainer.Size = new(base.Size.X, DropDownContainer.Size.Y + defaultOption.Size.Y);
|
||||
DropDownContainer.Controls.Add(defaultOption);
|
||||
defaultOption.Clicked += OptionOnClicked;
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
||||
SelectedOption = defaultOption;
|
||||
}
|
||||
|
||||
public void SetSelected(TSelection obj)
|
||||
{
|
||||
SelectedOption = obj;
|
||||
@ -68,11 +36,11 @@ public class DropDown<TSelection> : UserControl where TSelection : DropDownOptio
|
||||
obj.LoadDisplay.Invoke();
|
||||
}
|
||||
|
||||
public DropDown(Texture t, IRenderObject spacer, TSelection defaultOption)
|
||||
:base(t)
|
||||
public DropDown(Texture? InitTexture = null, RenderObjectCore? spacer = null, TSelection? defaultOption = null)
|
||||
:base(InitTexture)
|
||||
{
|
||||
ip = this;
|
||||
TextureDisplay = TextureDisplay.HorizontalCenter;
|
||||
if (InitTexture is not null) TextureDisplay = TextureDisplay.HorizontalCenter;
|
||||
DropDownContainer = new()
|
||||
{
|
||||
Visible = false,
|
||||
@ -80,35 +48,24 @@ public class DropDown<TSelection> : UserControl where TSelection : DropDownOptio
|
||||
};
|
||||
Clicked += OnClicked;
|
||||
WindowLoaded += OnWindowLoaded;
|
||||
DropDownContainer.Size = new(base.Size.X, DropDownContainer.Size.Y + spacer.Size.Y);
|
||||
DropDownContainer.Controls.Add(spacer);
|
||||
DropDownContainer.Size = new(base.Size.X, DropDownContainer.Size.Y + defaultOption.Size.Y);
|
||||
DropDownContainer.Controls.Add(defaultOption);
|
||||
defaultOption.Clicked += OptionOnClicked;
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
||||
SelectedOption = defaultOption;
|
||||
}
|
||||
|
||||
public DropDown(Texture t, IRenderObject spacer)
|
||||
:base(t)
|
||||
{
|
||||
ip = this;
|
||||
TextureDisplay = TextureDisplay.HorizontalCenter;
|
||||
DropDownContainer = new()
|
||||
if (spacer is not null)
|
||||
{
|
||||
Visible = false,
|
||||
Anchor = ObjectAnchor.Left | ObjectAnchor.Top | ObjectAnchor.Right
|
||||
};
|
||||
Clicked += OnClicked;
|
||||
WindowLoaded += OnWindowLoaded;
|
||||
DropDownContainer.Size = new(base.Size.X, DropDownContainer.Size.Y + spacer.Size.Y);
|
||||
DropDownContainer.Controls.Add(spacer);
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
||||
DropDownContainer.Size = new(base.Size.X, DropDownContainer.Size.Y + spacer.Size.Y);
|
||||
DropDownContainer.Controls.Add(spacer);
|
||||
}
|
||||
|
||||
if (defaultOption is not null)
|
||||
{
|
||||
AddOption(defaultOption);
|
||||
SelectedOption = defaultOption;
|
||||
}
|
||||
|
||||
if (InitTexture is not null) Shader = Rectangle.DefaultAlphaShader[Globals.RootWindow.Context];
|
||||
}
|
||||
|
||||
public TSelection SelectedOption { get; private set; }
|
||||
|
||||
private Task OnWindowLoaded(IRenderObject arg)
|
||||
private Task OnWindowLoaded(RenderObjectCore arg)
|
||||
{
|
||||
SelectedOption.LoadDisplay.Invoke();
|
||||
Window!.MouseDown += WindowOnMouseDown;
|
||||
@ -117,7 +74,7 @@ public class DropDown<TSelection> : UserControl where TSelection : DropDownOptio
|
||||
|
||||
private void WindowOnMouseDown(MouseButtonEventArgs obj)
|
||||
{
|
||||
if (IsOpen && !MouseInside)
|
||||
if (IsOpen && !MouseInsidePath)
|
||||
{
|
||||
IsOpen = false;
|
||||
DropDownContainer.Visible = IsOpen;
|
||||
@ -126,15 +83,15 @@ public class DropDown<TSelection> : UserControl where TSelection : DropDownOptio
|
||||
}
|
||||
}
|
||||
|
||||
private Task OnClicked(IRenderObject arg)
|
||||
private Task OnClicked(RenderObjectCore arg)
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
if (IsOpen)
|
||||
{
|
||||
IsOpen = false;
|
||||
DropDownContainer.Visible = IsOpen;
|
||||
if (OpenStatusChanged is not null) OpenStatusChanged.Invoke(IsOpen);
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
TryDraw();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
@ -149,7 +106,7 @@ public class DropDown<TSelection> : UserControl where TSelection : DropDownOptio
|
||||
DropDownContainer.Controls[0].Location = new(0);
|
||||
DropDownParentOverride.Controls.MoveControlToEnd(DropDownContainer);
|
||||
if (OpenStatusChanged is not null) OpenStatusChanged.Invoke(IsOpen);
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
TryDraw();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
@ -163,7 +120,7 @@ public class DropDown<TSelection> : UserControl where TSelection : DropDownOptio
|
||||
|
||||
public event Func<TSelection, Task>? OptionSelected;
|
||||
|
||||
private Task OptionOnClicked(IRenderObject arg)
|
||||
private Task OptionOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -2,8 +2,8 @@ using System.Diagnostics;
|
||||
using System.Text;
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
using GraphicsManager.Structs;
|
||||
using Luski.Enums;
|
||||
using Luski.net.Structures.Public;
|
||||
@ -16,15 +16,19 @@ namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
public class LuskiLabel : LabelBase
|
||||
{
|
||||
public LuskiLabel() : this(Globals.DefaultFont) { }
|
||||
public LuskiLabel(FontInteraction fi) : base(fi) { }
|
||||
public Color4 DefaultColor { get; set; } = Color4.White;
|
||||
|
||||
public override void LoadToParent(IParent window, IWindow win)
|
||||
|
||||
public LuskiLabel(FontInteraction fi) : base(fi)
|
||||
{
|
||||
if (Loaded) return;
|
||||
if (Shader is null) Shader = Globals.GradientShader[win.Context];
|
||||
base.LoadToParent(window, win);
|
||||
WindowLoaded += OnWindowLoaded;
|
||||
}
|
||||
|
||||
private Task OnWindowLoaded(RenderObjectCore arg)
|
||||
{
|
||||
if (Shader is null) Shader = Globals.GradientShader[Window!.Context];
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Color4 DefaultColor { get; set; } = Color4.White;
|
||||
float _alpha = 1;
|
||||
protected virtual (Color4,Color4) getGradcols(int Start, int charter, int End, int StartLine, int Line, int EndLine, GradType GT, Color4[] Colors)
|
||||
{
|
||||
@ -563,7 +567,7 @@ public class LuskiLabel : LabelBase
|
||||
private List<SubHitBox> Links = new();
|
||||
|
||||
|
||||
public override void Draw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
public override void DrawSelf()
|
||||
{
|
||||
if (Visible && Loaded)
|
||||
{
|
||||
@ -578,7 +582,9 @@ public class LuskiLabel : LabelBase
|
||||
|
||||
float angle_rad = (float)Math.Atan2(DIR.Y, DIR.X);
|
||||
Matrix4 rotateM = Matrix4.CreateRotationZ(angle_rad);
|
||||
Matrix4 transOriginM = Matrix4.CreateTranslation(new Vector3(loc_.X + Parent!.IntToWindow(0), loc_.Y + (MaxLineSizes[0].Item1.Y * Scale) + Parent!.IntToWindow(0, true), 0f));
|
||||
int y = 0;
|
||||
if (MaxLineSizes is not null && MaxLineSizes.Count > 0) y = MaxLineSizes[0].Item1.Y;
|
||||
Matrix4 transOriginM = Matrix4.CreateTranslation(new Vector3(loc_.X + Parent!.IntToWindow(0), loc_.Y + (y * Scale) + Parent!.IntToWindow(0, true), 0f));
|
||||
float char_x = 0.0f;
|
||||
Matrix4 staticTransform = rotateM * transOriginM;
|
||||
GL.UniformMatrix4(Shader.GetUniformLocation("model"), false, ref staticTransform);
|
||||
|
@ -1,6 +1,7 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using OpenTK.Mathematics;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
@ -17,11 +18,11 @@ public class MessageCompressedFlow : UserControl
|
||||
|
||||
public Vector4i WallSpacing { get; set; }
|
||||
|
||||
public event Func<IRenderObject, Task>? SizeUpdateNotIgnored;
|
||||
public event Func<RenderObjectCore, Task>? SizeUpdateNotIgnored;
|
||||
|
||||
private bool IgnoreNextSizeChange;
|
||||
|
||||
private Task OnSizeChanged(IRenderObject arg)
|
||||
private Task OnSizeChanged(RenderObjectCore arg)
|
||||
{
|
||||
if (IgnoreNextSizeChange)
|
||||
{
|
||||
@ -38,7 +39,7 @@ public class MessageCompressedFlow : UserControl
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task ControlsOnControlAdded(int arg1, IRenderObject arg2)
|
||||
private Task ControlsOnControlAdded(int arg1, RenderObjectCore arg2)
|
||||
{
|
||||
if (arg1 != 0)
|
||||
{
|
||||
|
@ -2,6 +2,7 @@ using System.Numerics;
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.Enums;
|
||||
using OpenTK.Mathematics;
|
||||
using OpenTK.Windowing.Common;
|
||||
@ -61,7 +62,9 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
||||
L3.Text = value.ToString() + Suffix;
|
||||
int x = GetX(value);
|
||||
L3.SetLocation(x - (L3.Size.X/2) + space, L3.Location.Y);
|
||||
L3.ForceDistanceUpdate(this);
|
||||
MaxLine.SetLocation(x + space, MaxLine.Location.Y);
|
||||
MaxLine.ForceDistanceUpdate(this);
|
||||
progressBar.UpdateProgress();
|
||||
}
|
||||
}
|
||||
@ -83,7 +86,7 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
||||
int i = 0;
|
||||
TNumber tmp = value - Min;
|
||||
if (progressBar.ProgressValue == tmp) return;
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
progressBar.ProgressValue = tmp;
|
||||
Type tt = typeof(TNumber);
|
||||
if (tt == typeof(double))
|
||||
@ -96,9 +99,12 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
||||
L2Cursor.SetLocation(x - (L2Cursor.Size.X/2) + space, L2Cursor.Location.Y);
|
||||
Cursor.SetLocation(x - (Cursor.Size.X/2) + space, MaxLine.Location.Y);
|
||||
Cursor.ForceDistanceUpdate(this);
|
||||
BlockDraw = false;
|
||||
L3.Visible = L2Cursor.Location.X + L2Cursor.Size.X < L3.Location.X;
|
||||
L1.Visible = L2Cursor.Location.X > L1.Location.X + L1.Size.X;
|
||||
L2Default.Visible = value != Default;
|
||||
RemoveBlockDraw();
|
||||
progressBar.UpdateProgress();
|
||||
if (Loaded && ValueChanged is not null) ValueChanged.Invoke(this);
|
||||
if (Loaded && BlockEvents == 0 && ValueChanged is not null) ValueChanged.Invoke(this);
|
||||
}
|
||||
}
|
||||
public bool LockToPoints { get; set; } = false;
|
||||
@ -130,8 +136,8 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
||||
progressBar.DrawingGap.W = progressBar.DrawingGap.X;
|
||||
progressBar.ProgressGap.X = 4.ScaleInt();
|
||||
progressBar.ProgressGap.Y = progressBar.ProgressGap.X;
|
||||
progressBar.BackgroundColor = Color4.DarkRed;
|
||||
progressBar.ProgressColor = Globals.DodgerBlue;
|
||||
progressBar.BackgroundColor = BackColor;
|
||||
progressBar.ProgressColor = FillColor;
|
||||
progressBar.UpdateOnDraw = false;
|
||||
progressBar.Anchor = ObjectAnchor.Left | ObjectAnchor.Right;
|
||||
progressBar.UpdateProgress();
|
||||
@ -139,7 +145,7 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
||||
progressBar.Clicked += ProgressBarOnClicked;
|
||||
Cursor.SetSize(10.ScaleInt(),24.ScaleInt());
|
||||
Cursor.SetLocation(0, base.Size.Y-Cursor.Size.Y);
|
||||
Cursor.BackgroundColor = Color4.White;
|
||||
Cursor.BackgroundColor = CursorColor;
|
||||
Cursor.Anchor = ObjectAnchor.PreventWidthChange;
|
||||
MinLine.SetSize(2.ScaleInt(), Cursor.Size.Y);
|
||||
MinLine.SetLocation(0, Cursor.Location.Y);
|
||||
@ -159,17 +165,126 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
||||
Controls.Add(L1);
|
||||
Controls.Add(L3);
|
||||
Controls.Add(L2Cursor);
|
||||
Controls.Add(L2Default);
|
||||
Controls.Add(MaxLine);
|
||||
Controls.Add(Cursor);
|
||||
Cursor.ForceDistanceUpdate(this);
|
||||
real_x = Cursor.Location.X;
|
||||
//Controls.Add(L2Cursor);
|
||||
progressBar.ForceDistanceUpdate(this);
|
||||
AllowHoverFromBehind = true;
|
||||
//AllowHoverFromBehind = true;
|
||||
WindowLoaded += OnWindowLoaded;
|
||||
}
|
||||
|
||||
private Color4 FillColorL = Globals.DodgerBlue, BackColorL = Color4.DarkRed, CursorColorL = Color4.White, DisabledCursorColorL = new(128, 128, 128, 255), DisabledFillColorL = new(15, 72, 128, 255), DisabledBackColorL = new(70, 0, 0, 255);
|
||||
private bool LocalDisabled;
|
||||
|
||||
public bool Disabled
|
||||
{
|
||||
get => LocalDisabled;
|
||||
set
|
||||
{
|
||||
if (LocalDisabled == value) return;
|
||||
LocalDisabled = value;
|
||||
AddBlockDraw();
|
||||
if (value)
|
||||
{
|
||||
progressBar.ProgressColor = DisabledFillColorL;
|
||||
progressBar.BackgroundColor = DisabledBackColorL;
|
||||
RemoveBlockDraw();
|
||||
Cursor.BackgroundColor = DisabledCursorColorL;
|
||||
return;
|
||||
}
|
||||
|
||||
progressBar.ProgressColor = FillColorL;
|
||||
progressBar.BackgroundColor = BackColorL;
|
||||
RemoveBlockDraw();
|
||||
Cursor.BackgroundColor = CursorColorL;
|
||||
}
|
||||
}
|
||||
|
||||
public Color4 CursorColor
|
||||
{
|
||||
get => CursorColorL;
|
||||
set
|
||||
{
|
||||
if (CursorColorL == value) return;
|
||||
CursorColorL = value;
|
||||
if (Disabled) return;
|
||||
Cursor.BackgroundColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color4 DisabledCursorColor
|
||||
{
|
||||
get => DisabledCursorColorL;
|
||||
set
|
||||
{
|
||||
if (DisabledCursorColorL == value) return;
|
||||
DisabledCursorColorL = value;
|
||||
if (!Disabled) return;
|
||||
Cursor.BackgroundColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Task ProgressBarOnClicked(IRenderObject arg)
|
||||
public Color4 FillColor
|
||||
{
|
||||
get => FillColorL;
|
||||
set
|
||||
{
|
||||
if (FillColorL == value) return;
|
||||
FillColorL = value;
|
||||
if (Disabled) return;
|
||||
progressBar.ProgressColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color4 DisabledFillColor
|
||||
{
|
||||
get => DisabledFillColorL;
|
||||
set
|
||||
{
|
||||
if (DisabledFillColorL == value) return;
|
||||
DisabledFillColorL = value;
|
||||
if (!Disabled) return;
|
||||
progressBar.ProgressColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color4 BackColor
|
||||
{
|
||||
get => BackColorL;
|
||||
set
|
||||
{
|
||||
if (BackColorL == value) return;
|
||||
BackColorL = value;
|
||||
if (Disabled) return;
|
||||
progressBar.BackgroundColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color4 DisabledBackColor
|
||||
{
|
||||
get => DisabledBackColorL;
|
||||
set
|
||||
{
|
||||
if (DisabledBackColorL == value) return;
|
||||
DisabledBackColorL = value;
|
||||
if (!Disabled) return;
|
||||
progressBar.BackgroundColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Task OnWindowLoaded(RenderObjectCore arg)
|
||||
{
|
||||
Window!.MouseUp += WindowOnMouseUp;
|
||||
Window!.MouseMove += WindowOnMouseMove;
|
||||
Cursor.Clicked += CursorOnClicked;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task ProgressBarOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
if (Disabled) return Task.CompletedTask;
|
||||
Value = progressBar.GetValueFromX((int)Window!.MousePosition.X - progressBar.GetWindowLocation().X) + Min;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
@ -180,32 +295,30 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
||||
ExtraPoints.Add(value);
|
||||
}
|
||||
|
||||
public override void SetSize(int w, int h)
|
||||
private byte BlockEvents = 0;
|
||||
|
||||
public override void SetSize(int w, int h, bool UpdateOpenGLCords = true, bool TrigerSizeEvent = true,
|
||||
bool TrigerParentSizeEvent = true, bool TryDraw = true, bool UpdateDistance = false)
|
||||
{
|
||||
base.SetSize(w, 50.ScaleInt());
|
||||
base.SetSize(w, 50.ScaleInt(), UpdateOpenGLCords, TrigerSizeEvent, TrigerParentSizeEvent, TryDraw, UpdateDistance);
|
||||
progressBar.SetSize(w - space - space, 8.ScaleInt());
|
||||
progressBar.UpdateProgress();
|
||||
progressBar.ForceDistanceUpdate(this);
|
||||
Min = Min;
|
||||
BlockEvents++;
|
||||
Value--;
|
||||
Value++;
|
||||
BlockEvents--;
|
||||
progressBar.UpdateProgress();
|
||||
}
|
||||
|
||||
public override void LoadToParent(IParent p, IWindow w)
|
||||
{
|
||||
base.LoadToParent(p, w);
|
||||
w.MouseUp += WindowOnMouseUp;
|
||||
w.MouseMove += WindowOnMouseMove;
|
||||
Cursor.Clicked += CursorOnClicked;
|
||||
}
|
||||
|
||||
public bool Draging;
|
||||
|
||||
private int real_x, real_dif;
|
||||
|
||||
private Task CursorOnClicked(IRenderObject arg)
|
||||
private Task CursorOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
if (Disabled) return Task.CompletedTask;
|
||||
Draging = true;
|
||||
real_dif = ((int)Window!.MousePosition.X - Cursor.GetWindowLocation().X);
|
||||
real_x = Cursor.Location.X + real_dif;
|
||||
@ -214,6 +327,7 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
||||
|
||||
private void WindowOnMouseMove(MouseMoveEventArgs obj)
|
||||
{
|
||||
if (Disabled) return;
|
||||
if (!Draging) return;
|
||||
real_x += (int)obj.DeltaX;
|
||||
Value = progressBar.GetValueFromX(real_x) + Min;
|
||||
@ -221,6 +335,7 @@ public class NumberSelector<TNumber> : UserControl where TNumber : INumber<TNumb
|
||||
|
||||
private void WindowOnMouseUp(MouseButtonEventArgs obj)
|
||||
{
|
||||
if (Disabled) return;
|
||||
if (!Draging) return;
|
||||
Draging = false;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class ProfileView : UserControl
|
||||
{
|
||||
public SocketUser User { get; set; }
|
||||
|
||||
private ProfileView(IRenderObject user, SocketUser u, ServerProfile p, Role r)
|
||||
private ProfileView(RenderObjectCore user, SocketUser u, ServerProfile p, Role r)
|
||||
{
|
||||
this.User = u;
|
||||
base.Size = new(244.ScaleInt(), 44.ScaleInt());
|
||||
|
@ -1,12 +1,15 @@
|
||||
using GraphicsManager.Globals;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using OpenTK.Mathematics;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
|
||||
public class ServerFlow : FlowLayout
|
||||
{
|
||||
public override void ResizeDraw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
/*public override void ResizeDraw(int x, int y, int sx, int sy, int sw, int sh)
|
||||
{
|
||||
if (OldHeight == Size.Y)
|
||||
{
|
||||
@ -44,7 +47,7 @@ public class ServerFlow : FlowLayout
|
||||
}
|
||||
else
|
||||
{
|
||||
Controls[i].Draw(x,y,sx,sy,sw,sh);
|
||||
Controls[i].dra(x,y,sx,sy,sw,sh);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -53,5 +56,5 @@ public class ServerFlow : FlowLayout
|
||||
if (!UpdateScissorBox(ref x, ref y, ref sx, ref sy, ref sw, ref sh)) return;
|
||||
Window!.CopyFromFrontToBack(x, y, Size.X, Size.Y, x, y);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls.ServerForms;
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
using OpenTK.Mathematics;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
||||
|
||||
public interface ISettingsPage : IRenderObject
|
||||
public interface ISettingsPage
|
||||
{
|
||||
public string PageName { get; set; }
|
||||
public FontInteraction TitleFont { get; set; }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
using Luski.GUI.MainScreen.UI.Generic;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
||||
|
@ -11,7 +11,7 @@ public class PageTab : UserControl
|
||||
public static Texture? seltec = null;
|
||||
private SettingsMenu SM;
|
||||
private Label l;
|
||||
public required IRenderObject Page;
|
||||
public required RenderObjectCore Page;
|
||||
|
||||
public PageTab(string Text, SettingsMenu SM)
|
||||
:base(seltec)
|
||||
@ -19,7 +19,7 @@ public class PageTab : UserControl
|
||||
this.SM = SM;
|
||||
base.Size = new(297.ScaleInt(), 40.ScaleInt());
|
||||
TextureDisplay = TextureDisplay.HorizontalCenter;
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.RootWindow.Context];
|
||||
l = new Label(Globals.DefaultFont)
|
||||
{
|
||||
Text = Text,
|
||||
@ -49,7 +49,7 @@ public class PageTab : UserControl
|
||||
};
|
||||
}
|
||||
|
||||
private async Task OnClicked(IRenderObject arg)
|
||||
private async Task OnClicked(RenderObjectCore arg)
|
||||
{
|
||||
if (!Selected) await ToggleSelected();
|
||||
}
|
||||
@ -67,7 +67,7 @@ public class PageTab : UserControl
|
||||
f = Color4.Gray;
|
||||
}
|
||||
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
Selected = !Selected;
|
||||
|
||||
if (SM.Selected is not null && SM.Selected != this)
|
||||
@ -80,11 +80,11 @@ public class PageTab : UserControl
|
||||
{
|
||||
if (SM.Selected is not null) SM.Selected.Page.Visible = false;
|
||||
SM.Selected = this;
|
||||
Globals.ms.Title = $"Settings | {l.Text} - Luski";
|
||||
Globals.RootWindow.Title = $"Settings | {l.Text} - Luski";
|
||||
Page.Visible = true;
|
||||
}
|
||||
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
TryDraw();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -1,6 +1,7 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
using OpenTK.Mathematics;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
||||
@ -46,25 +47,26 @@ public class SettingsCategory<TSettingsMenu> : UserControl where TSettingsMenu :
|
||||
|
||||
public PageTab AddPage<TPage>(TPage Page) where TPage : ISettingsPage
|
||||
{
|
||||
Page.Location = new(ss.fl.Size.X + 40.ScaleInt(), 0);
|
||||
Page.Size = new(Globals.ms.CS.X - ss.fl.Size.X - 80.ScaleInt(), Globals.ms.CS.Y);
|
||||
Page.AllowHoverFromBehind = true;
|
||||
Page.Anchor = ObjectAnchor.All;
|
||||
RenderObjectCore roc = (Page as RenderObjectCore)!;
|
||||
roc.Location = new(ss.fl.Size.X + 40.ScaleInt(), 0);
|
||||
roc.Size = new(Globals.RootWindow.CS.X - ss.fl.Size.X - 80.ScaleInt(), Globals.RootWindow.CS.Y);
|
||||
//roc.AllowHoverFromBehind = true;
|
||||
roc.Anchor = ObjectAnchor.All;
|
||||
Page.BackgroundColor = ss.BackgroundColor;
|
||||
pagest.Add(typeof(TPage));
|
||||
pages.Add(Page.PageName);
|
||||
ss.Controls.Add(Page);
|
||||
ss.Controls.Add(roc);
|
||||
if (Page is PageFlow pbf) pbf.HScrollPixels = Globals.Settings.PerScrollPixels;
|
||||
PageTab cb = new(Page.PageName, ss)
|
||||
{
|
||||
Page = Page
|
||||
Page = roc
|
||||
};
|
||||
Controls.Add(cb);
|
||||
int f = 5.ScaleInt();
|
||||
cb.Location = new (line.Location.X + f, line.Location.Y - f);
|
||||
line.Location = new(line.Location.X, line.Location.Y + cb.Size.Y + f);
|
||||
Size = new(Size.X, Size.Y + cb.Size.Y + f);
|
||||
Page.Tag = cb;
|
||||
roc.Tag = cb;
|
||||
return cb;
|
||||
}
|
||||
|
||||
@ -81,7 +83,7 @@ public class SettingsCategory<TSettingsMenu> : UserControl where TSettingsMenu :
|
||||
return pagest.Contains(name);
|
||||
}
|
||||
|
||||
public void RemovePage<TPage>(TPage Page) where TPage : ISettingsPage
|
||||
public void RemovePage<TPage>(TPage Page) where TPage : RenderObjectCore, ISettingsPage
|
||||
{
|
||||
if (Page.Tag is PageTab cb)
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
||||
using OpenTK.Mathematics;
|
||||
|
||||
@ -15,9 +16,9 @@ public class SettingsMenu : UserControl
|
||||
public SettingsMenu(string Name)
|
||||
{
|
||||
base.BackgroundColor = new(34, 34, 34, 255);
|
||||
base.Size = Globals.ms.ClientSize;
|
||||
BehindName = Globals.ms.Title;
|
||||
Globals.ms.Title = Name;
|
||||
base.Size = Globals.RootWindow.ClientSize;
|
||||
BehindName = Globals.RootWindow.Title;
|
||||
Globals.RootWindow.Title = Name;
|
||||
fl = new()
|
||||
{
|
||||
BackgroundColor = new(20, 20, 20, 255),
|
||||
@ -26,11 +27,11 @@ public class SettingsMenu : UserControl
|
||||
};
|
||||
Anchor = ObjectAnchor.All;
|
||||
Controls.Add(fl);
|
||||
Rectangle closebtn = new(Globals.ms.TextureManager.GetTextureResource("close.png"))
|
||||
Rectangle closebtn = new(Globals.RootWindow.TextureManager.GetTextureResource("close.png"))
|
||||
{
|
||||
Location = new(Globals.ms.ClientSize.X - 40.ScaleInt(), 8.ScaleInt()),
|
||||
Location = new(Globals.RootWindow.ClientSize.X - 40.ScaleInt(), 8.ScaleInt()),
|
||||
Size = new(32.ScaleInt()),
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.RootWindow.Context],
|
||||
BackgroundColor = Color4.Gray,
|
||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Right
|
||||
};
|
||||
@ -41,11 +42,11 @@ public class SettingsMenu : UserControl
|
||||
};
|
||||
closebtn.MouseLeave += _ =>
|
||||
{
|
||||
if (bl) BlockDraw = true;
|
||||
if (bl) AddBlockDraw();
|
||||
closebtn.BackgroundColor = Color4.Gray;
|
||||
if (bl)
|
||||
{
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
bl = false;
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
@ -57,12 +58,12 @@ public class SettingsMenu : UserControl
|
||||
|
||||
private bool bl;
|
||||
|
||||
private Task ClosebtnOnClicked(IRenderObject arg)
|
||||
private Task ClosebtnOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
bl = true;
|
||||
Globals.ms.Controls.Remove(this, false);
|
||||
Globals.ms.Title = BehindName;
|
||||
Globals.ms.DrawFrame();
|
||||
Globals.RootWindow.Controls.Remove(this, false);
|
||||
Globals.RootWindow.Title = BehindName;
|
||||
Globals.RootWindow.DrawFrame();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
@ -1,37 +1,38 @@
|
||||
using System.Timers;
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
using OpenTK.Mathematics;
|
||||
using OpenTK.Windowing.Common;
|
||||
using OpenTK.Windowing.Common.Input;
|
||||
using OpenTK.Windowing.GraphicsLibraryFramework;
|
||||
using Rectangle = GraphicsManager.Objects.Core.Rectangle;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
|
||||
public class TextBox : UserControl
|
||||
{
|
||||
private Label _watermark, _label;
|
||||
private bool use;
|
||||
private Rectangle Pointer;
|
||||
private Timer t;
|
||||
private readonly Label BackWatermark;
|
||||
private readonly Label BackLabel;
|
||||
private readonly Rectangle Pointer;
|
||||
private readonly Timer t;
|
||||
|
||||
public int CursorLocation { get; set; }
|
||||
|
||||
public TextBox(string defaul = "Textbox.png")
|
||||
:base(Globals.ms.TextureManager.GetTextureResource(defaul))
|
||||
public TextBox(string DefaultTexture = "Textbox.png")
|
||||
:base(Globals.RootWindow.TextureManager.GetTextureResource(DefaultTexture))
|
||||
{
|
||||
t = new(500);
|
||||
t.Elapsed += TOnElapsed;
|
||||
TextureDisplay = TextureDisplay.Center;
|
||||
_label = new Label(Globals.DefaultFont)
|
||||
base.TextureDisplay = TextureDisplay.Center;
|
||||
BackLabel = new Label(Globals.DefaultFont)
|
||||
{
|
||||
HoverMouse = MouseCursor.IBeam,
|
||||
IgnoreHover = true
|
||||
};
|
||||
_watermark = new(_label.Font)
|
||||
BackWatermark = new(BackLabel.Font)
|
||||
{
|
||||
Text = "Text Box",
|
||||
Color = new(128, 128, 128, 255),
|
||||
@ -41,8 +42,8 @@ public class TextBox : UserControl
|
||||
Pointer = new()
|
||||
{
|
||||
Size = new(1.ScaleInt(),
|
||||
(int)_label.LineHeight ),
|
||||
Location = _watermark.Location,
|
||||
(int)BackLabel.LineHeight ),
|
||||
Location = BackWatermark.Location,
|
||||
BackgroundColor = Color4.White,
|
||||
Visible = false,
|
||||
IgnoreHover = true
|
||||
@ -50,13 +51,20 @@ public class TextBox : UserControl
|
||||
IgnoreVisForChildren = true;
|
||||
Controls.Add(Pointer);
|
||||
|
||||
Controls.Add(_label);
|
||||
Controls.Add(_watermark);
|
||||
Controls.Add(BackLabel);
|
||||
Controls.Add(BackWatermark);
|
||||
WindowLoaded += OnWindowLoaded;
|
||||
}
|
||||
|
||||
private void TOnElapsed(object? sender, ElapsedEventArgs e)
|
||||
private Task OnWindowLoaded(RenderObjectCore _)
|
||||
{
|
||||
Globals.ms.Invoke(() =>
|
||||
Pointer.Location = BackWatermark.Location;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void TOnElapsed(object? _, ElapsedEventArgs __)
|
||||
{
|
||||
Globals.RootWindow.Invoke(() =>
|
||||
{
|
||||
Pointer.Visible = !Pointer.Visible;
|
||||
});
|
||||
@ -68,47 +76,27 @@ public class TextBox : UserControl
|
||||
|
||||
public override void UnFocus()
|
||||
{
|
||||
use = false;
|
||||
base.UnFocus();
|
||||
t.Stop();
|
||||
Pointer.Visible = false;
|
||||
if (Window is not null && Window.focused == this)
|
||||
Window.focused = null;
|
||||
|
||||
}
|
||||
public override void Focus()
|
||||
{
|
||||
if (Window is not null)
|
||||
{
|
||||
if (Window.focused is not null)
|
||||
{
|
||||
Window.focused.UnFocus();
|
||||
}
|
||||
t.Start();
|
||||
|
||||
Window.focused = this;
|
||||
use = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void LoadToParent(IParent parent, IWindow window)
|
||||
{
|
||||
if (Loaded) return;
|
||||
window.MouseDown += Window_MouseDown;
|
||||
if (!window.Context.IsCurrent) window.Context.MakeCurrent();
|
||||
base.LoadToParent(parent, window);
|
||||
Pointer.Location = _watermark.Location;
|
||||
base.Focus();
|
||||
if (Window is null) return;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
public override void SendClipEvent(string ClipString)
|
||||
{
|
||||
base.SendClipEvent(ClipString);
|
||||
if (!use) return;
|
||||
try
|
||||
{
|
||||
Text = Text.Insert(CursorLocation, ClipString);
|
||||
CursorLocation += ClipString.Length;
|
||||
Vector2i f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector2i(f.X, f.Y);
|
||||
Vector2i f = BackLabel.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = BackLabel.Location + new Vector2i(f.X, f.Y);
|
||||
Pointer.Visible = true;
|
||||
if (LetterPress is not null) LetterPress.Invoke().Wait();
|
||||
}
|
||||
@ -118,7 +106,7 @@ public class TextBox : UserControl
|
||||
}
|
||||
}
|
||||
|
||||
public char? PasswordChar { get => _label.PasswordChar; set => _label.PasswordChar = value; }
|
||||
public char? PasswordChar { get => BackLabel.PasswordChar; set => BackLabel.PasswordChar = value; }
|
||||
|
||||
private TextLocation tl = TextLocation.TopLeft;
|
||||
|
||||
@ -130,23 +118,23 @@ public class TextBox : UserControl
|
||||
tl = value;
|
||||
if (!string.IsNullOrWhiteSpace(Text))
|
||||
{
|
||||
_label.Location = value switch
|
||||
BackLabel.Location = value switch
|
||||
{
|
||||
TextLocation.LineCenter => new(10.ScaleInt(),
|
||||
((Size.Y - _label.Size.Y) / 2)),
|
||||
_ => _label.Location
|
||||
((Size.Y - BackLabel.Size.Y) / 2)),
|
||||
_ => BackLabel.Location
|
||||
};
|
||||
_watermark.Location = _label.Location;
|
||||
BackWatermark.Location = BackLabel.Location;
|
||||
}
|
||||
else
|
||||
{
|
||||
_watermark.Location = value switch
|
||||
BackWatermark.Location = value switch
|
||||
{
|
||||
TextLocation.LineCenter => new(10.ScaleInt(),
|
||||
((Size.Y - _watermark.Size.Y) / 2)),
|
||||
_ => _watermark.Location
|
||||
((Size.Y - BackWatermark.Size.Y) / 2)),
|
||||
_ => BackWatermark.Location
|
||||
};
|
||||
_label.Location = _watermark.Location;
|
||||
BackLabel.Location = BackWatermark.Location;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,53 +147,53 @@ public class TextBox : UserControl
|
||||
if (value == base.Visible) return;
|
||||
if (value)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_label.Text))
|
||||
if (!string.IsNullOrEmpty(BackLabel.Text))
|
||||
{
|
||||
_label.Visible = true;
|
||||
_watermark.Visible = false;
|
||||
BackLabel.Visible = true;
|
||||
BackWatermark.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_label.Visible = false;
|
||||
_watermark.Visible = true;
|
||||
BackLabel.Visible = false;
|
||||
BackWatermark.Visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_label.Visible = value;
|
||||
_watermark.Visible = value;
|
||||
BackLabel.Visible = value;
|
||||
BackWatermark.Visible = value;
|
||||
}
|
||||
|
||||
base.Visible = value;
|
||||
}
|
||||
}
|
||||
|
||||
public FontInteraction Font { get => _label.Font; }
|
||||
public FontInteraction WatermarkFont { get => _watermark.Font; }
|
||||
public FontInteraction Font { get => BackLabel.Font; }
|
||||
public FontInteraction WatermarkFont { get => BackWatermark.Font; }
|
||||
|
||||
public Color4 TextColor { get => _label.Color; set => _label.Color = value; }
|
||||
public Color4 WatermarkColor { get => _watermark.Color; set => _watermark.Color = value; }
|
||||
public Color4 TextColor { get => BackLabel.Color; set => BackLabel.Color = value; }
|
||||
public Color4 WatermarkColor { get => BackWatermark.Color; set => BackWatermark.Color = value; }
|
||||
|
||||
public bool AllowMultiLine { get; set; } = true;
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => _label.Text;
|
||||
get => BackLabel.Text;
|
||||
set
|
||||
{
|
||||
int old = _label.Size.Y;
|
||||
_label.Text = value;
|
||||
int old = BackLabel.Size.Y;
|
||||
BackLabel.Text = value;
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
bool f = false;
|
||||
if (!_label.Visible)
|
||||
if (!BackLabel.Visible)
|
||||
{
|
||||
f = true;
|
||||
_label.Visible = true;
|
||||
_label.Location = TextLocation switch
|
||||
BackLabel.Visible = true;
|
||||
BackLabel.Location = TextLocation switch
|
||||
{
|
||||
TextLocation.LineCenter => new(10.ScaleInt(), ((Size.Y - _label.Size.Y) / 2)),
|
||||
_ => _label.Location
|
||||
TextLocation.LineCenter => new(10.ScaleInt(), ((Size.Y - BackLabel.Size.Y) / 2)),
|
||||
_ => BackLabel.Location
|
||||
};
|
||||
/*
|
||||
_label.Location = TextLocation switch
|
||||
@ -215,43 +203,35 @@ public class TextBox : UserControl
|
||||
TextLocation.PxLeft => new(Location.X + 5, Location.Y + ((Size.Y - _label.Size.Y) / 2), Location.Z),
|
||||
_ => new(Location.X + 5, Location.Y + 5, Location.Z)
|
||||
};*/
|
||||
_watermark.Location = _label.Location;
|
||||
BackWatermark.Location = BackLabel.Location;
|
||||
}
|
||||
if (_watermark.Visible) _watermark.Visible = false;
|
||||
if (!f && TextLocation == TextLocation.LineCenter && old != _label.Size.Y)
|
||||
if (BackWatermark.Visible) BackWatermark.Visible = false;
|
||||
if (!f && TextLocation == TextLocation.LineCenter && old != BackLabel.Size.Y)
|
||||
{
|
||||
//_label.Location = new(Location.X + 5, Location.Y + ((Size.Y - _label.TrueHeight) / 2) - (_label.Size.Y - _label.TrueHeight), Location.Z);
|
||||
_watermark.Location = _label.Location;
|
||||
BackWatermark.Location = BackLabel.Location;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_label.Visible) _label.Visible = false;
|
||||
if (!_watermark.Visible)
|
||||
if (BackLabel.Visible) BackLabel.Visible = false;
|
||||
if (!BackWatermark.Visible)
|
||||
{
|
||||
_watermark.Visible = true;
|
||||
_watermark.Location = TextLocation switch
|
||||
BackWatermark.Visible = true;
|
||||
BackWatermark.Location = TextLocation switch
|
||||
{
|
||||
TextLocation.LineCenter => new(10.ScaleInt(), ((Size.Y - _watermark.Size.Y) / 2)),
|
||||
_ => _watermark.Location
|
||||
TextLocation.LineCenter => new(10.ScaleInt(), ((Size.Y - BackWatermark.Size.Y) / 2)),
|
||||
_ => BackWatermark.Location
|
||||
};
|
||||
/*
|
||||
_watermark.Location = TextLocation switch
|
||||
{
|
||||
TextLocation.TrueCenterLeft => new(Location.X + 5, Location.Y + ((Size.Y - _watermark.TrueHeight) / 2) - (_watermark.Size.Y - _watermark.TrueHeight), Location.Z),
|
||||
TextLocation.PostiveTureCenterLeft => new(Location.X + 5, Location.Y + ((Size.Y - _label.PostiveTrueHeight) / 2) - _label.Size.Y + _label.TrueHeight, Location.Z),
|
||||
TextLocation.PxLeft => new(Location.X + 5, Location.Y + ((Size.Y - _watermark.Size.Y) / 2), Location.Z),
|
||||
_ => new(Location.X + 5, Location.Y + 5, Location.Z)
|
||||
};*/
|
||||
_label.Location = _label.Location;
|
||||
BackLabel.Location = BackLabel.Location;
|
||||
}
|
||||
}
|
||||
|
||||
if (_label.Text.Length < CursorLocation)
|
||||
if (BackLabel.Text.Length < CursorLocation)
|
||||
{
|
||||
CursorLocation = _label.Text.Length;
|
||||
var xy = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = new(_label.Location.X + xy.X, _label.Location.Y + xy.Y);
|
||||
CursorLocation = BackLabel.Text.Length;
|
||||
var xy = BackLabel.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = new(BackLabel.Location.X + xy.X, BackLabel.Location.Y + xy.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -259,14 +239,14 @@ public class TextBox : UserControl
|
||||
{
|
||||
get
|
||||
{
|
||||
return _watermark.Text;
|
||||
return BackWatermark.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
_watermark.Text = value;
|
||||
BackWatermark.Text = value;
|
||||
if (string.IsNullOrEmpty(Text))
|
||||
{
|
||||
Pointer.Location = _label.Location;
|
||||
Pointer.Location = BackLabel.Location;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -277,35 +257,34 @@ public class TextBox : UserControl
|
||||
public override void SendKeyEvent(KeyboardKeyEventArgs KeyArgs)
|
||||
{
|
||||
base.SendKeyEvent(KeyArgs);
|
||||
if (!use) return;
|
||||
if (KeyArgs.Key == Keys.Left && CursorLocation != 0)
|
||||
{
|
||||
CursorLocation--;
|
||||
var f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector2i(f.X, f.Y);
|
||||
var f = BackLabel.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = BackLabel.Location + new Vector2i(f.X, f.Y);
|
||||
Pointer.Visible = true;
|
||||
}
|
||||
if (KeyArgs.Key == Keys.Right && CursorLocation != Text.Length)
|
||||
{
|
||||
CursorLocation++;
|
||||
var f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector2i(f.X, f.Y);
|
||||
var f = BackLabel.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = BackLabel.Location + new Vector2i(f.X, f.Y);
|
||||
Pointer.Visible = true;
|
||||
}
|
||||
if (KeyArgs.Key == Keys.CapsLock || KeyArgs.Key == Keys.Menu || KeyArgs.Key == Keys.LeftSuper || KeyArgs.Key == Keys.RightSuper || KeyArgs.Key == Keys.End || KeyArgs.Key == Keys.Home || KeyArgs.Key == Keys.PageDown || KeyArgs.Key == Keys.PageUp || KeyArgs.Key == Keys.Insert || KeyArgs.Key == Keys.Up || KeyArgs.Key == Keys.Down || KeyArgs.Key == Keys.Left || KeyArgs.Key == Keys.Right) return;
|
||||
if (KeyArgs.Key is Keys.CapsLock or Keys.Menu or Keys.LeftSuper or Keys.RightSuper or Keys.End or Keys.Home or Keys.PageDown or Keys.PageUp or Keys.Insert or Keys.Up or Keys.Down or Keys.Left or Keys.Right) return;
|
||||
if (KeyArgs.Key == Keys.Backspace)
|
||||
{
|
||||
if (!(Text.Length > 0)) return;
|
||||
if (Text[CursorLocation- 1] == '\n')
|
||||
{
|
||||
Size = new(Size.X, Size.Y - (int)_label.Font.PixelHeight);
|
||||
Size = new(Size.X, Size.Y - (int)BackLabel.Font.PixelHeight);
|
||||
if (OnRemoveLine is not null) OnRemoveLine.Invoke().Wait();
|
||||
}
|
||||
CursorLocation--;
|
||||
Text = Text.Remove(CursorLocation, 1);
|
||||
if (LetterRemoved is not null) LetterRemoved.Invoke().Wait();
|
||||
var f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector2i(f.X, f.Y);
|
||||
var f = BackLabel.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = BackLabel.Location + new Vector2i(f.X, f.Y);
|
||||
Pointer.Visible = true;
|
||||
}
|
||||
if (KeyArgs.Key == Keys.Delete)
|
||||
@ -313,7 +292,7 @@ public class TextBox : UserControl
|
||||
if (CursorLocation == Text.Length) return;
|
||||
if (Text[CursorLocation] == '\n')
|
||||
{
|
||||
Size = new(Size.X, Size.Y - (int)_label.Font.PixelHeight);
|
||||
Size = new(Size.X, Size.Y - (int)BackLabel.Font.PixelHeight);
|
||||
if (OnRemoveLine is not null) OnRemoveLine.Invoke().Wait();
|
||||
}
|
||||
Text = Text.Remove(CursorLocation, 1);
|
||||
@ -324,14 +303,14 @@ public class TextBox : UserControl
|
||||
{
|
||||
if (AllowMultiLine && KeyArgs.Shift)
|
||||
{
|
||||
BlockDraw = true;
|
||||
Size = new(Size.X, Size.Y + (int)_label.Font.PixelHeight);
|
||||
AddBlockDraw();
|
||||
Size = new(Size.X, Size.Y + (int)BackLabel.Font.PixelHeight);
|
||||
if (OnNewLine is not null) OnNewLine.Invoke().Wait();
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
Text += '\n';
|
||||
CursorLocation++;
|
||||
var f = _label.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = _label.Location + new Vector2i(f.X, f.Y);
|
||||
var f = BackLabel.GetCharLocation(CursorLocation);
|
||||
Pointer.Location = BackLabel.Location + new Vector2i(f.X, f.Y);
|
||||
Pointer.Visible = true;
|
||||
}
|
||||
else
|
||||
@ -342,13 +321,13 @@ public class TextBox : UserControl
|
||||
|
||||
|
||||
|
||||
if (KeyArgs.Key == Keys.V && KeyArgs.Control && Window is not null)
|
||||
if (KeyArgs is { Key: Keys.V, Control: true } && Window is not null)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
SendClipEvent(Window.ClipboardString);
|
||||
if (LetterPress is not null) LetterPress.Invoke().Wait();
|
||||
LetterPress?.Invoke().Wait();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -357,14 +336,4 @@ public class TextBox : UserControl
|
||||
}
|
||||
if (KeyPress is not null) _ = KeyPress.Invoke(KeyArgs);
|
||||
}
|
||||
|
||||
private void Window_MouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (MouseInside && e.Button == MouseButton.Button1)
|
||||
{
|
||||
use = true;
|
||||
Focus();
|
||||
}
|
||||
else UnFocus();
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using OpenTK.Mathematics;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
@ -7,11 +8,11 @@ namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
public class ToggleSwitch : UserControl
|
||||
{
|
||||
public ToggleSwitch()
|
||||
:base(Globals.ms.TextureManager.GetTextureResource("Toggle.png"))
|
||||
:base(Globals.RootWindow.TextureManager.GetTextureResource("Toggle.png"))
|
||||
{
|
||||
base.SetSize(40.ScaleInt(), 24.ScaleInt());
|
||||
base.BackgroundColor = OffBackgroundColor;
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.RootWindow.Context];
|
||||
Clicked += o =>
|
||||
{
|
||||
Value = !Value;
|
||||
@ -21,13 +22,6 @@ public class ToggleSwitch : UserControl
|
||||
|
||||
public event Func<ToggleSwitch, Task>? ValueChanged;
|
||||
|
||||
public override void LoadToParent(IParent Parent, IWindow Window)
|
||||
{
|
||||
Value = !Value;
|
||||
Value = !Value;
|
||||
base.LoadToParent(Parent, Window);
|
||||
}
|
||||
|
||||
public new Vector2i Size
|
||||
{
|
||||
get => base.Size;
|
||||
|
@ -12,7 +12,7 @@ public class UserView : UserControl
|
||||
{
|
||||
public SocketUser User { get; set; }
|
||||
|
||||
private UserView(IRenderObject user, SocketUser u, ServerProfile p, Role r, bool offline)
|
||||
private UserView(RenderObjectCore user, SocketUser u, ServerProfile p, Role r, bool offline)
|
||||
{
|
||||
this.User = u;
|
||||
base.Size = new(244.ScaleInt(), 44.ScaleInt());
|
||||
|
@ -1,5 +1,6 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using OpenTK.Mathematics;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Reflection;
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.Classes;
|
||||
using Luski.Classes.Attribs;
|
||||
using Luski.Enums.Strings;
|
||||
@ -32,23 +33,27 @@ public class GlobalSettingsMenu : SettingsMenu
|
||||
|
||||
private void LoadPages<TFile>()
|
||||
{
|
||||
foreach (PropertyInfo prop in typeof(TFile).GetProperties())
|
||||
try
|
||||
{
|
||||
if (!prop.TryGetAnyAttribute(out SettingInfoAttribute? p)) continue;
|
||||
if (!categories.ContainsKey(p.Group))
|
||||
foreach (PropertyInfo prop in typeof(TFile).GetProperties())
|
||||
{
|
||||
categories.Add(p.Group, new SettingsCategory<GlobalSettingsMenu>(p.Group, this));
|
||||
fl.Controls.Add(categories[p.Group]);
|
||||
}
|
||||
|
||||
if (!categories[p.Group].HasPage(SettingsPage.Pages[p.Page].Name))
|
||||
{
|
||||
PageTab tab = categories[p.Group].AddPage(p.CreatePage());
|
||||
if (First is null)
|
||||
if (!prop.TryGetAnyAttribute(out SettingInfoAttribute? p)) continue;
|
||||
if (!categories.ContainsKey(p.Group))
|
||||
{
|
||||
First = tab;
|
||||
categories.Add(p.Group, new SettingsCategory<GlobalSettingsMenu>(p.Group, this));
|
||||
fl.Controls.Add(categories[p.Group]);
|
||||
}
|
||||
|
||||
if (categories[p.Group].HasPage(SettingsPage.Pages[p.Page].Name)) continue;
|
||||
PageTab tab = categories[p.Group].AddPage(p.CreatePage());
|
||||
First ??= tab;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.Classes;
|
||||
using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
||||
using Luski.GUI.MainScreen.UI.SettingsPanel;
|
||||
|
@ -68,7 +68,7 @@ public class Updater : PageFlow
|
||||
|
||||
WindowLoaded += _ =>
|
||||
{
|
||||
Globals.ms.ForceUpdate();
|
||||
Globals.RootWindow.ForceUpdate();
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.Classes;
|
||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
|
||||
@ -79,7 +80,7 @@ public class Appearance : PageFlow
|
||||
};
|
||||
ThemeDrop.OpenStatusChanged += b =>
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
Size = new(base.Size.X, base.Size.Y + ( b ? ThemeDrop.DropDownContainer.Size.Y : -1 * ThemeDrop.DropDownContainer.Size.Y));
|
||||
line!.Location = new(line.Location.X,
|
||||
line.Location.Y + (b ? ThemeDrop.DropDownContainer.Size.Y : -1 * ThemeDrop.DropDownContainer.Size.Y));
|
||||
@ -92,7 +93,7 @@ public class Appearance : PageFlow
|
||||
ThemeDrop.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png");
|
||||
}
|
||||
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
Controls.Add(ThemeDrop);
|
||||
|
@ -1,6 +1,7 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.GUI.MainScreen.Interfaces;
|
||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
using Luski.net.Structures.Public;
|
||||
@ -67,7 +68,7 @@ public class AddChannel : UserControl
|
||||
Anchor = ObjectAnchor.All;
|
||||
}
|
||||
|
||||
private async Task BtnOnClicked(IRenderObject arg)
|
||||
private async Task BtnOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
SocketChannel chan = await Cat.Server.MakeChannel(Cat, cn.Text, cd.Text);
|
||||
await CA.AddChannel(chan);
|
||||
|
@ -21,8 +21,8 @@ public class ChatMessage : UserControl
|
||||
|
||||
public PublicChat pc;
|
||||
|
||||
private IRenderObject LastObject;
|
||||
public List<IRenderObject> MessageObjs = new();
|
||||
private RenderObjectCore LastObject;
|
||||
public List<RenderObjectCore> MessageObjs = new();
|
||||
private LabelBase FirstL;
|
||||
public MessageCompressedFlow MCF;
|
||||
|
||||
@ -40,7 +40,7 @@ public class ChatMessage : UserControl
|
||||
}
|
||||
|
||||
|
||||
private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, ServerProfile Author, IRenderObject UserIcon, Role r)
|
||||
private ChatMessage(PublicChat p, SocketMessage message, SocketChannel chan, ServerProfile Author, RenderObjectCore UserIcon, Role r)
|
||||
{
|
||||
|
||||
pc = p;
|
||||
@ -192,7 +192,7 @@ public class ChatMessage : UserControl
|
||||
base.BackgroundColor = new(0,0,0,50);
|
||||
}
|
||||
|
||||
private Task MCFOnSizeUpdateNotIgnored(IRenderObject arg)
|
||||
private Task MCFOnSizeUpdateNotIgnored(RenderObjectCore arg)
|
||||
{
|
||||
base.Size = new(base.Size.X , MCF.Size.Y + MCF.Location.Y);
|
||||
return Task.CompletedTask;
|
||||
@ -201,7 +201,7 @@ public class ChatMessage : UserControl
|
||||
|
||||
public async Task AddMessage(SocketMessage msg)
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
LuskiLabel newLabel;
|
||||
if (!string.IsNullOrWhiteSpace(msg.Context))
|
||||
{
|
||||
@ -255,7 +255,7 @@ public class ChatMessage : UserControl
|
||||
};
|
||||
for (int i = 0; i < msg.Files.Count; i++)
|
||||
{
|
||||
IRenderObject cem = await ContentEmbed.GetEmbed(this, msg.Files[i], msg.ChannelID);
|
||||
RenderObjectCore cem = await ContentEmbed.GetEmbed(this, msg.Files[i], msg.ChannelID);
|
||||
cf.Controls.Add(cem);
|
||||
}
|
||||
MCF.Controls.Add(cf);
|
||||
@ -263,11 +263,11 @@ public class ChatMessage : UserControl
|
||||
|
||||
Size = new(Size.X , MCF.Size.Y + MCF.Location.Y);
|
||||
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
TryDraw();
|
||||
}
|
||||
|
||||
private Task NewLabelOnClicked(IRenderObject arg)
|
||||
private Task NewLabelOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -288,7 +288,7 @@ public class ChatMessage : UserControl
|
||||
}
|
||||
|
||||
readonly List<Label> Labels = new();
|
||||
private async Task NewLabel_MouseLeave(IRenderObject sender)
|
||||
private async Task NewLabel_MouseLeave(RenderObjectCore sender)
|
||||
{
|
||||
if (sender is not Label label) return;
|
||||
if (label.Tag is not SocketMessage Message) return;
|
||||
@ -312,7 +312,7 @@ public class ChatMessage : UserControl
|
||||
Window!.TryDraw();
|
||||
}
|
||||
|
||||
private async Task NewLabel_MouseEnter(IRenderObject sender)
|
||||
private async Task NewLabel_MouseEnter(RenderObjectCore sender)
|
||||
{
|
||||
if (sender is not Label label) return;
|
||||
if (label.Tag is not SocketMessage Message) return;
|
||||
|
@ -1,11 +1,10 @@
|
||||
using System.Reflection;
|
||||
using GraphicsManager;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.net.Structures.Public;
|
||||
using OpenTK.Windowing.Common.Input;
|
||||
using Rectangle = GraphicsManager.Objects.Rectangle;
|
||||
using Rectangle = GraphicsManager.Objects.Core.Rectangle;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI.PublicServers;
|
||||
|
||||
@ -16,7 +15,7 @@ public class ContentEmbed : UserControl
|
||||
public static Texture? DownloadIcon = null;
|
||||
long channel;
|
||||
private static bool isopen;
|
||||
public static async Task<IRenderObject> GetEmbed(ChatMessage m, SocketFile file, long channel)
|
||||
public static async Task<RenderObjectCore> GetEmbed(ChatMessage m, SocketFile file, long channel)
|
||||
{
|
||||
|
||||
if (file.Name.ToLower().EndsWith(".png") || file.Name.ToLower().EndsWith(".jpg"))
|
||||
@ -45,7 +44,7 @@ public class ContentEmbed : UserControl
|
||||
}
|
||||
}
|
||||
|
||||
private static Task ROnClicked(IRenderObject arg)
|
||||
private static Task ROnClicked(RenderObjectCore arg)
|
||||
{
|
||||
if (isopen) return Task.CompletedTask;
|
||||
isopen = true;
|
||||
@ -54,7 +53,6 @@ public class ContentEmbed : UserControl
|
||||
Globals.ms.Controls.Add(r = FullScreenMedia.GetDisplay(((Rectangle)arg).Textures[0]));
|
||||
if (arg.Tag is PublicChat pc)
|
||||
{
|
||||
pc.MessageFlow.AllowHoverFromBehind = false;
|
||||
r.Tag = pc;
|
||||
}
|
||||
|
||||
@ -63,19 +61,14 @@ public class ContentEmbed : UserControl
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private static Task RrOnClicked(IRenderObject arg)
|
||||
private static Task RrOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
isopen = false;
|
||||
Globals.ms.Controls.Remove(arg);
|
||||
Globals.ms.DrawFrame();
|
||||
FullScreenMedia fsm = (arg as FullScreenMedia)!;
|
||||
fsm.Clicked -= RrOnClicked;
|
||||
if (fsm.Tag is PublicChat pc)
|
||||
{
|
||||
pc.MessageFlow.AllowHoverFromBehind = true;
|
||||
}
|
||||
fsm.Clean();
|
||||
fsm = null!;
|
||||
fsm.Parent!.Controls.Remove(fsm);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@ -120,7 +113,7 @@ public class ContentEmbed : UserControl
|
||||
base.BackgroundColor = new(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
private Task FileNameLabelOnClicked(IRenderObject arg)
|
||||
private Task FileNameLabelOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
string dir = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Downloads", "LuskiDownloads");
|
||||
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||
|
@ -31,10 +31,10 @@ public class PublicChat : UserControl
|
||||
private FlowLayout? memberflow = null;
|
||||
|
||||
public PublicChat()
|
||||
:base(null)
|
||||
{
|
||||
base.SetSize(980.ScaleInt(), 866.ScaleInt());
|
||||
base.BackgroundColor = new(40,40,40,255);
|
||||
Anchor = ObjectAnchor.All;
|
||||
Controls.Add(MessageFlow = new()
|
||||
{
|
||||
Size = new(base.Size.X, 785.ScaleInt()),
|
||||
@ -59,13 +59,14 @@ public class PublicChat : UserControl
|
||||
Size = new(980.ScaleInt(), 48.ScaleInt()),
|
||||
BackgroundColor = new(50,50,50,255),
|
||||
});
|
||||
Texture tmp = Globals.RootWindow.TextureManager.GetTextureResource("person.png");
|
||||
UserCon =
|
||||
new(Globals.ms.TextureManager.GetTextureResource("person.png"))
|
||||
new(tmp)
|
||||
{
|
||||
Size = new(24.ScaleInt()),
|
||||
Location = new(944.ScaleInt(), 12.ScaleInt()),
|
||||
Anchor = ObjectAnchor.Right | ObjectAnchor.Top,
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.RootWindow.Context],
|
||||
BackgroundColor = Color4.LightGray
|
||||
};
|
||||
UserCon.MouseEnter += o => { UserCon.BackgroundColor = Color4.White; return Task.CompletedTask; };
|
||||
@ -90,18 +91,18 @@ public class PublicChat : UserControl
|
||||
// InsideColor = new(28, 28, 28, 255),
|
||||
//BorderColor = Color4.DarkCyan,
|
||||
Location = new(10.ScaleInt(), 824.ScaleInt()),
|
||||
Size = new(960.ScaleInt(), 34.ScaleInt()),
|
||||
Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left | ObjectAnchor.Right,
|
||||
HoverMouse = MouseCursor.IBeam,
|
||||
//Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
//Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context],
|
||||
BackgroundColor = Color4.Red,
|
||||
TextLocation = TextLocation.LineCenter
|
||||
//BackgroundColor = Color4.Red,
|
||||
Size = new(960.ScaleInt(), 34.ScaleInt()),
|
||||
TextLocation = TextLocation.LineCenter,
|
||||
|
||||
});
|
||||
tb.KeyPress += TbOnKeyPress;
|
||||
tb.OnRemoveLine += TbOnOnRemoveLine;
|
||||
tb.OnNewLine += TbOnOnNewLine;
|
||||
tb.ForceDistanceUpdate(this);
|
||||
CollectUpperFiles = true;
|
||||
FilesDroped += OnFilesDroped;
|
||||
FileFlow = new()
|
||||
@ -119,11 +120,11 @@ public class PublicChat : UserControl
|
||||
|
||||
private bool ssss = false;
|
||||
|
||||
private Task OnSizeChanged(IRenderObject arg)
|
||||
private Task OnSizeChanged(RenderObjectCore arg)
|
||||
{
|
||||
if (ssss) return Task.CompletedTask;
|
||||
ssss = true;
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
bool off = false;
|
||||
for (int j = 0; j < MessageFlow.Controls.Length; j++)
|
||||
{
|
||||
@ -156,7 +157,7 @@ public class PublicChat : UserControl
|
||||
ssss = false;
|
||||
}
|
||||
}
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@ -212,19 +213,19 @@ public class PublicChat : UserControl
|
||||
|
||||
private Task TbOnOnRemoveLine()
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
tb.Location = new(tb.Location.X, tb.Location.Y + (int)tb.Font.PixelHeight);
|
||||
MessageFlow.SetSize(MessageFlow.Size.X, MessageFlow.Size.Y + (int)tb.Font.PixelHeight);
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task TbOnOnNewLine()
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
tb.Location = new(tb.Location.X, tb.Location.Y - (int)tb.Font.PixelHeight);
|
||||
MessageFlow.Size = new(MessageFlow.Size.X, MessageFlow.Size.Y - (int)tb.Font.PixelHeight);
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@ -232,10 +233,10 @@ public class PublicChat : UserControl
|
||||
private bool SeperateOffline = true;
|
||||
|
||||
|
||||
private async Task UserConOnClicked(IRenderObject arg)
|
||||
private async Task UserConOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
BlockDraw = true;
|
||||
um_open = !um_open;
|
||||
AddBlockDraw();
|
||||
if (um_open)
|
||||
{
|
||||
if (memberflow is null)
|
||||
@ -301,9 +302,9 @@ public class PublicChat : UserControl
|
||||
{
|
||||
if (!SeperateOffline && !Users.ContainsKey(user.Id)) return;
|
||||
Role top_role2 = (await user.GetRoles())[0];
|
||||
Globals.ms.Invoke(async () =>
|
||||
Globals.RootWindow.Invoke(async () =>
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
if (status == UserStatus.Offline && user.Status != UserStatus.Offline)
|
||||
{
|
||||
Offline!.RemoveUser(user.Id);
|
||||
@ -359,8 +360,8 @@ public class PublicChat : UserControl
|
||||
Users[user.Id] = Offline;
|
||||
}
|
||||
|
||||
BlockDraw = false;
|
||||
Globals.ms.DrawFrame();
|
||||
RemoveBlockDraw();
|
||||
Globals.RootWindow.DrawFrame();
|
||||
});
|
||||
}
|
||||
|
||||
@ -383,7 +384,7 @@ public class PublicChat : UserControl
|
||||
tb.ForceDistanceUpdate();
|
||||
}
|
||||
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
TryDraw();
|
||||
}
|
||||
|
||||
@ -400,15 +401,15 @@ public class PublicChat : UserControl
|
||||
private List<FileUpload> FilesToUpload = new();
|
||||
private CompressedFlow FileFlow;
|
||||
|
||||
private Task OnFilesDroped(IRenderObject arg1, string[] arg2)
|
||||
private Task OnFilesDroped(RenderObjectCore arg1, string[] arg2)
|
||||
{
|
||||
int last = arg2.Length - 1;
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
for (int i = 0; i < last; i++)
|
||||
{
|
||||
AddFile(arg2[i], false);
|
||||
}
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
AddFile(arg2[last]);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
@ -429,7 +430,7 @@ public class PublicChat : UserControl
|
||||
|
||||
private int OldSize = 0;
|
||||
|
||||
private Task CFOnSizeChanged(IRenderObject arg)
|
||||
private Task CFOnSizeChanged(RenderObjectCore arg)
|
||||
{
|
||||
arg.Location = new(arg.Location.X, arg.Location.Y + OldSize - arg.Size.Y);
|
||||
MessageFlow.Size = new(MessageFlow.Size.X, FileFlow.Location.Y - MessageFlow.Location.Y);
|
||||
@ -458,8 +459,8 @@ public class PublicChat : UserControl
|
||||
public async Task LoadChannel(SocketChannel channel)
|
||||
{
|
||||
Channel = channel;
|
||||
BlockDraw = true;
|
||||
Globals.ms.BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
Globals.RootWindow.BlockDraw = true;
|
||||
if (memberflow is not null)
|
||||
{
|
||||
await UserConOnClicked(UserCon!);
|
||||
@ -484,8 +485,8 @@ public class PublicChat : UserControl
|
||||
tb.Text = "";
|
||||
tb.CursorLocation = 0;
|
||||
tb.Focus();
|
||||
Globals.ms.BlockDraw = false;
|
||||
BlockDraw = false;
|
||||
Globals.RootWindow.BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
TryDraw();
|
||||
}
|
||||
|
||||
@ -502,7 +503,7 @@ public class PublicChat : UserControl
|
||||
|
||||
public async Task AddMessages(IEnumerable<SocketMessage> messages, bool reverse = true)
|
||||
{
|
||||
MessageFlow.BlockDraw = true;
|
||||
MessageFlow.AddBlockDraw();
|
||||
if (reverse)
|
||||
{
|
||||
foreach (SocketMessage message in messages.Reverse())
|
||||
@ -517,18 +518,18 @@ public class PublicChat : UserControl
|
||||
await AddMessage(message);
|
||||
}
|
||||
}
|
||||
MessageFlow.BlockDraw = false;
|
||||
MessageFlow.RemoveBlockDraw();
|
||||
}
|
||||
|
||||
public async Task AddMessagesIndex(IEnumerable<SocketMessage> messages)
|
||||
{
|
||||
MessageFlow.BlockDraw = true;
|
||||
MessageFlow.AddBlockDraw();
|
||||
index = 0;
|
||||
foreach (SocketMessage message in messages.Reverse())
|
||||
{
|
||||
await AddMessageIndex(message);
|
||||
}
|
||||
MessageFlow.BlockDraw = false;
|
||||
MessageFlow.RemoveBlockDraw();
|
||||
}
|
||||
|
||||
public async Task AddMessage(SocketMessage Message, bool scrool = false)
|
||||
@ -545,14 +546,14 @@ public class PublicChat : UserControl
|
||||
lastm = Message;
|
||||
if (lastUser is null || lastUser != Message.ProfileID || hasbeentenmin)
|
||||
{
|
||||
if (Window is null || !Globals.ms.InvokeRequired)
|
||||
if (Window is null || !Globals.RootWindow.InvokeRequired)
|
||||
{
|
||||
MessageFlow.Controls.Add(LastChatMessage = await ChatMessage.MakeChatMessage(this, Message));
|
||||
if (scrool) MessageFlow.ScrollToBottom();
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals.ms.Invoke(async () =>
|
||||
Globals.RootWindow.Invoke(async () =>
|
||||
{
|
||||
LastChatMessage = await ChatMessage.MakeChatMessage(this, Message);
|
||||
MessageFlow.Controls.Add(LastChatMessage);
|
||||
@ -563,14 +564,14 @@ public class PublicChat : UserControl
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Window is null || !Globals.ms.InvokeRequired)
|
||||
if (Window is null || !Globals.RootWindow.InvokeRequired)
|
||||
{
|
||||
await LastChatMessage!.AddMessage(Message);
|
||||
if (scrool) MessageFlow.ScrollToBottom();
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals.ms.Invoke(() =>
|
||||
Globals.RootWindow.Invoke(() =>
|
||||
{
|
||||
LastChatMessage!.AddMessage(Message);
|
||||
if (scrool) MessageFlow.ScrollToBottom();
|
||||
@ -593,19 +594,19 @@ public class PublicChat : UserControl
|
||||
lastmIndex = Message;
|
||||
if (lastUserIndex is null || lastUserIndex != Message.ProfileID || hasbeentenmin)
|
||||
{
|
||||
if (Window is null || !Globals.ms.InvokeRequired)
|
||||
if (Window is null || !Globals.RootWindow.InvokeRequired)
|
||||
{
|
||||
MessageFlow.Controls.Insert(index, LastChatMessageIndex = await ChatMessage.MakeChatMessage(this, Message));
|
||||
LastChatMessageIndex.LoadToParent(MessageFlow, Globals.ms);
|
||||
// LastChatMessageIndex.LoadToParent(MessageFlow, Globals.RootWindow);
|
||||
index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
LastChatMessageIndex = await ChatMessage.MakeChatMessage(this, Message);
|
||||
Globals.ms.Invoke(() =>
|
||||
Globals.RootWindow.Invoke(() =>
|
||||
{
|
||||
MessageFlow.Controls.Insert(index, LastChatMessageIndex);
|
||||
LastChatMessageIndex.LoadToParent(MessageFlow, Globals.ms);
|
||||
//LastChatMessageIndex.LoadToParent(MessageFlow, Globals.RootWindow);
|
||||
index++;
|
||||
Window.TryDraw();
|
||||
});
|
||||
@ -613,13 +614,13 @@ public class PublicChat : UserControl
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Window is null || !Globals.ms.InvokeRequired)
|
||||
if (Window is null || !Globals.RootWindow.InvokeRequired)
|
||||
{
|
||||
await LastChatMessageIndex!.AddMessage(Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals.ms.Invoke(() =>
|
||||
Globals.RootWindow.Invoke(() =>
|
||||
{
|
||||
LastChatMessageIndex!.AddMessage(Message);
|
||||
Window!.TryDraw();
|
||||
|
@ -1,5 +1,6 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.net.Structures.Public;
|
||||
using OpenTK.Mathematics;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
|
@ -1,5 +1,6 @@
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
using Luski.net.Structures.Public;
|
||||
using Luski.Shared.PublicServers.V1.Enums;
|
||||
@ -12,7 +13,7 @@ public class RoleMember : UserControl
|
||||
public RoleMember(ServerProfile p, SocketUser u)
|
||||
{
|
||||
base.Size = new(500.ScaleInt(), 40.ScaleInt());
|
||||
Task<IRenderObject> icon = p.MakeRct(u, new(24.ScaleInt()));
|
||||
Task<RenderObjectCore> icon = p.MakeRct(u, new(24.ScaleInt()));
|
||||
icon.Wait();
|
||||
int val = 8.ScaleInt();
|
||||
icon.Result.Location = new(val, val);
|
||||
|
@ -1,5 +1,6 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.net;
|
||||
using Luski.net.Structures.Public;
|
||||
using OpenTK.Mathematics;
|
||||
|
@ -3,6 +3,7 @@ using System.Reflection;
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using Luski.net.Structures.Public;
|
||||
using Luski.Shared.PublicServers.V1.Enums;
|
||||
using OpenTK.Mathematics;
|
||||
@ -77,7 +78,7 @@ public class ServerRoleOptions : UserControl
|
||||
};
|
||||
}
|
||||
|
||||
private Task PageOnSizeChanged(IRenderObject arg)
|
||||
private Task PageOnSizeChanged(RenderObjectCore arg)
|
||||
{
|
||||
foreach (Label l in NeedMax)
|
||||
{
|
||||
@ -135,7 +136,7 @@ public class ServerRoleOptions : UserControl
|
||||
SelectedLine.Size = new(Permissions.Size.X, Line.Size.Y);
|
||||
SelectedLine.Location = new(Permissions.Location.X, Line.Location.Y);
|
||||
RemoveSaveEvents();
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
Page.Controls.Clear();
|
||||
TempPermissions = r.ServerPermissions;
|
||||
NeedMax.Clear();
|
||||
@ -196,7 +197,7 @@ public class ServerRoleOptions : UserControl
|
||||
{
|
||||
Page.ScrollValue = scrval.Value;
|
||||
}
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
TryDraw();
|
||||
}
|
||||
|
||||
@ -223,7 +224,7 @@ public class ServerRoleOptions : UserControl
|
||||
Page.ScrollToTop();
|
||||
}
|
||||
CurrentPageToLoad = LoadMembers;
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
SelectedLine.Size = new(ManageMembers.Size.X, Line.Size.Y);
|
||||
SelectedLine.Location = new(ManageMembers.Location.X, Line.Location.Y);
|
||||
Page.Controls.Clear();
|
||||
@ -238,7 +239,7 @@ public class ServerRoleOptions : UserControl
|
||||
BackgroundColor = Page.BackgroundColor
|
||||
});
|
||||
}
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
TryDraw();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ public class ServerIcon<TServer> : UserControl where TServer : Server
|
||||
|
||||
public async Task LoadServer()
|
||||
{
|
||||
Console.WriteLine("Loading server pre...");
|
||||
Selected = true;
|
||||
if (ser1 is not null)
|
||||
{
|
||||
@ -97,7 +98,7 @@ public class ServerIcon<TServer> : UserControl where TServer : Server
|
||||
base.SetSize(68.ScaleInt(), 48.ScaleInt());
|
||||
}
|
||||
|
||||
private async Task OnClicked(IRenderObject arg)
|
||||
private async Task OnClicked(RenderObjectCore arg)
|
||||
{
|
||||
if (Selected) return;
|
||||
await LoadServer();
|
||||
|
@ -9,7 +9,7 @@ using Luski.net;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using OpenTK.Mathematics;
|
||||
using OpenTK.Windowing.GraphicsLibraryFramework;
|
||||
using Rectangle = GraphicsManager.Objects.Rectangle;
|
||||
using Rectangle = GraphicsManager.Objects.Core.Rectangle;
|
||||
|
||||
namespace Luski.GUI.MainScreen.UI;
|
||||
|
||||
@ -167,7 +167,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
version.DropDownContainer.BackgroundColor = version.BackgroundColor;
|
||||
version.OpenStatusChanged += b =>
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
if (b)
|
||||
{
|
||||
version.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangleTop.png");
|
||||
@ -177,7 +177,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
version.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png");
|
||||
}
|
||||
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
@ -492,7 +492,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
btn.Clicked += BtnOnClicked;
|
||||
}
|
||||
|
||||
private async Task BtnOnClicked(IRenderObject arg)
|
||||
private async Task BtnOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
if (btn.Textures[0].handel == Globals.ms.TextureManager.GetTextureResource("BadTextbox.png").handel)
|
||||
return;
|
||||
@ -557,7 +557,7 @@ public class ServerLoginOverlay : UserControl, IServerOverlay
|
||||
|
||||
private string pfp = "";
|
||||
|
||||
private Task RecOnFilesDroped(IRenderObject obj, string[] arg)
|
||||
private Task RecOnFilesDroped(RenderObjectCore obj, string[] arg)
|
||||
{
|
||||
Console.WriteLine(arg[0]);
|
||||
if (!arg[0].ToLower().EndsWith("png")) return Task.CompletedTask;
|
||||
|
@ -14,12 +14,12 @@ public class ExperimentDropButton : DropDownOption
|
||||
public ExperimentSelectorInfo ESI;
|
||||
|
||||
public ExperimentDropButton(ExperimentSelectorInfo esi)
|
||||
:base(Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png"))
|
||||
:base(Globals.RootWindow.TextureManager.GetTextureResource("RoundedRectangle.png"))
|
||||
{
|
||||
ESI = esi;
|
||||
base.Size = new(297.ScaleInt(), 40.ScaleInt());
|
||||
TextureDisplay = TextureDisplay.HorizontalCenter;
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
||||
Shader = Rectangle.DefaultAlphaShader[Globals.RootWindow.Context];
|
||||
l = new Label(Globals.DefaultFont)
|
||||
{
|
||||
Text = esi.Name,
|
||||
|
@ -29,11 +29,11 @@ public class ExperimentGUI : UserControl
|
||||
TextureDisplay = TextureDisplay.Center;
|
||||
if (TopOpen is null)
|
||||
{
|
||||
TopOpen = Globals.ms.TextureManager.GetTextureResource("RoundedRectangleTop.png");
|
||||
TopOpen = Globals.RootWindow.TextureManager.GetTextureResource("RoundedRectangleTop.png");
|
||||
}
|
||||
if (BottomOpen is null)
|
||||
{
|
||||
BottomOpen = Globals.ms.TextureManager.GetTextureResource("RoundedRectangleBottom.png");
|
||||
BottomOpen = Globals.RootWindow.TextureManager.GetTextureResource("RoundedRectangleBottom.png");
|
||||
}
|
||||
Top = new(Globals.DefaultFont)
|
||||
{
|
||||
@ -64,7 +64,7 @@ public class ExperimentGUI : UserControl
|
||||
},
|
||||
Size = new(297.ScaleInt(), 40.ScaleInt())
|
||||
};
|
||||
dd = new(Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png"), new Rectangle()
|
||||
dd = new(Globals.RootWindow.TextureManager.GetTextureResource("RoundedRectangle.png"), new Rectangle()
|
||||
{
|
||||
Size = new(1.ScaleInt()),
|
||||
BackgroundColor = Color4.Gray
|
||||
@ -78,11 +78,11 @@ public class ExperimentGUI : UserControl
|
||||
};
|
||||
dd.DropDownContainer.Textures.Add(BottomOpen);
|
||||
dd.DropDownContainer.TextureDisplay = TextureDisplay.Center;
|
||||
dd.DropDownContainer.Shader = Rectangle.DefaultAlphaShader[Globals.ms.Context];
|
||||
dd.DropDownContainer.Shader = Rectangle.DefaultAlphaShader[Globals.RootWindow.Context];
|
||||
dd.DropDownContainer.BackgroundColor = dd.BackgroundColor;
|
||||
dd.OpenStatusChanged += b =>
|
||||
{
|
||||
BlockDraw = true;
|
||||
AddBlockDraw();
|
||||
SetSize(base.Size.X, base.Size.Y + ( b ? dd.DropDownContainer.Size.Y : -1 * dd.DropDownContainer.Size.Y));
|
||||
if (b)
|
||||
{
|
||||
@ -90,10 +90,10 @@ public class ExperimentGUI : UserControl
|
||||
}
|
||||
else
|
||||
{
|
||||
dd.Textures[0] = Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png");
|
||||
dd.Textures[0] = Globals.RootWindow.TextureManager.GetTextureResource("RoundedRectangle.png");
|
||||
}
|
||||
|
||||
BlockDraw = false;
|
||||
RemoveBlockDraw();
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
int i = -1;
|
||||
@ -125,7 +125,7 @@ public class ExperimentGUI : UserControl
|
||||
}
|
||||
dd.OptionSelected += DdOnOptionSelected;
|
||||
Controls.Add(dd);
|
||||
base.Size = new(Globals.ms.ClientSize.X - 307.ScaleInt() - 80.ScaleInt(), 15.ScaleInt() + dd.Size.Y + dd.Location.Y );
|
||||
base.Size = new(Globals.RootWindow.ClientSize.X - 307.ScaleInt() - 80.ScaleInt(), 15.ScaleInt() + dd.Size.Y + dd.Location.Y );
|
||||
dd.Size = new(base.Size.X - Top.Location.X - Top.Location.X, dd.Size.Y);
|
||||
dd.ForceDistanceUpdate(this);
|
||||
Controls.Add(Top);
|
||||
|
@ -5,6 +5,7 @@ using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
using Luski.GUI.MainScreen.UI;
|
||||
using Luski.GUI.MainScreen.UI.Generic;
|
||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
@ -197,7 +198,7 @@ public class MainScreenWindow : Window
|
||||
WindowLoaded += OnWindowLoaded;
|
||||
BlockDraw = true;
|
||||
}
|
||||
|
||||
|
||||
private async Task OnWindowLoaded(Window arg)
|
||||
{
|
||||
BlockDraw = false;
|
||||
@ -237,6 +238,7 @@ public class MainScreenWindow : Window
|
||||
|
||||
public async Task LoadPublicServer(PublicServer? Server)
|
||||
{
|
||||
Console.WriteLine("Loading Server...");
|
||||
GL.Enable(EnableCap.DepthTest);
|
||||
GL.Enable(EnableCap.Multisample);
|
||||
GL.DepthFunc(DepthFunction.Always);
|
||||
@ -264,7 +266,6 @@ public class MainScreenWindow : Window
|
||||
Controls.Add(ServerFlow);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Server Title
|
||||
|
||||
Label title = new(Globals.DefaultFont)
|
||||
@ -318,8 +319,7 @@ public class MainScreenWindow : Window
|
||||
Size = new(Size.X - ChannelSelector.Size.X - ServerFlow.Size.X, CS.Y),
|
||||
};
|
||||
Controls.Add(ChatBoxArea);
|
||||
ChatBoxArea.LoadToParent(this, this);
|
||||
ChatBoxArea.ForceDistanceUpdate();
|
||||
ChatBoxArea.ForceDistanceUpdate(this);
|
||||
ChatBoxArea.MessageFlow.ForceDistanceUpdate(ChatBoxArea);
|
||||
#endregion
|
||||
|
||||
@ -331,13 +331,12 @@ public class MainScreenWindow : Window
|
||||
|
||||
#region User Icon
|
||||
ServerProfile DefaultProfile = await Server.GetProfile(Server.User.ServerProfile, CancellationToken.None);
|
||||
IRenderObject u = await DefaultProfile.MakeRct(Server.User, new(46.ScaleInt()));
|
||||
RenderObjectCore u = await DefaultProfile.MakeRct(Server.User, new(46.ScaleInt()));
|
||||
int ii = 4.ScaleInt();
|
||||
u.Location = new(ii + ServerFlow.Size.X, ChannelSelector.Location.Y + ChannelSelector.Size.Y + ii);
|
||||
u.Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left;
|
||||
Controls.Add(u);
|
||||
u.LoadToParent(this, this);
|
||||
u.ForceDistanceUpdate();
|
||||
u.ForceDistanceUpdate(this);
|
||||
string name = DefaultProfile.DisplayName;
|
||||
Role r = (await Server.User.GetRoles())[0];
|
||||
if (r.ColorType == ColorType.Full)
|
||||
@ -361,7 +360,7 @@ public class MainScreenWindow : Window
|
||||
Size = new(20.ScaleInt()),
|
||||
Shader = Rectangle.DefaultAlphaShader[Context],
|
||||
BackgroundColor = Color4.Gray,
|
||||
Tag = new Tuple<SocketAppUser, IRenderObject, LabelBase>(Server.User, u, ul),
|
||||
Tag = new Tuple<SocketAppUser, RenderObjectCore, LabelBase>(Server.User, u, ul),
|
||||
Anchor = u.Anchor
|
||||
};
|
||||
Expand.Clicked += ExpandOnClicked;
|
||||
@ -414,46 +413,6 @@ public class MainScreenWindow : Window
|
||||
BlockDraw = false;
|
||||
}
|
||||
|
||||
protected override void OnFileDrop(FileDropEventArgs obj)
|
||||
{
|
||||
void CheckFileDrop(IParent ParentToCheck, Vector2i diff)
|
||||
{
|
||||
bool found = false;
|
||||
for (int i = ParentToCheck.Controls.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if ((ParentToCheck.Controls[i].Location + diff).X <= (int)MousePosition.X &&
|
||||
(ParentToCheck.Controls[i].Location + diff).Y <= (int)MousePosition.Y &&
|
||||
(ParentToCheck.Controls[i].Location + ParentToCheck.Controls[i].Size + diff).X >= (int)MousePosition.X &&
|
||||
(ParentToCheck.Controls[i].Location + ParentToCheck.Controls[i].Size + diff).Y >= (int)MousePosition.Y)
|
||||
{
|
||||
if (ParentToCheck.Controls[i] is IParent NextParentToCheck)
|
||||
{
|
||||
if (NextParentToCheck.CollectUpperFiles)
|
||||
{
|
||||
found = true;
|
||||
ParentToCheck.Controls[i].SendFilesEvent(obj.FileNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckFileDrop(NextParentToCheck, ParentToCheck.Controls[i].Location + diff);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
found = true;
|
||||
ParentToCheck.Controls[i].SendFilesEvent(obj.FileNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && ParentToCheck is IRenderObject renderObject)
|
||||
{
|
||||
renderObject.SendFilesEvent(obj.FileNames);
|
||||
}
|
||||
}
|
||||
CheckFileDrop(this, new(0));
|
||||
}
|
||||
|
||||
private FlowLayout? ProfileFlow;
|
||||
|
||||
public override void ForceUpdate(bool resize = false)
|
||||
@ -461,23 +420,23 @@ public class MainScreenWindow : Window
|
||||
base.ForceUpdate(resize && LuskiExperiments.GUI.BufferCopy.IsEnabled());
|
||||
}
|
||||
|
||||
private async Task ExpandOnClicked(IRenderObject arg)
|
||||
private async Task ExpandOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ProfileFlow is null)
|
||||
{
|
||||
ProfileFlow = new();
|
||||
Tuple<SocketAppUser, IRenderObject, LabelBase> s = (Tuple<SocketAppUser, IRenderObject, LabelBase>)arg.Tag!;
|
||||
Tuple<SocketAppUser, RenderObjectCore, LabelBase> s = (Tuple<SocketAppUser, RenderObjectCore, LabelBase>)arg.Tag!;
|
||||
var role = (await s.Item1.GetRoles())[0];
|
||||
foreach (ServerProfile prof in await s.Item1.GetProfiles(CancellationToken.None))
|
||||
{
|
||||
ProfileView con = await ProfileView.Make(s.Item1, prof, role);
|
||||
con.Clicked += async _ =>
|
||||
{
|
||||
IRenderObject iro = await prof.MakeRct(s.Item1, s.Item2.Size);
|
||||
RenderObjectCore iro = await prof.MakeRct(s.Item1, s.Item2.Size);
|
||||
iro.Location = s.Item2.Location;
|
||||
iro.Distance = s.Item2.Distance;
|
||||
// iro.Distance = s.Item2.Distance;
|
||||
iro.Anchor = s.Item2.Anchor;
|
||||
int oldx = s.Item3.Size.X;
|
||||
s.Item2.Parent!.Controls.Add(iro);
|
||||
@ -488,7 +447,7 @@ public class MainScreenWindow : Window
|
||||
arg.Location = new(arg.Location.X - oldx + s.Item3.Size.X, arg.Location.Y);
|
||||
arg.ForceDistanceUpdate(arg.Parent!);
|
||||
Globals.ServerProfile = prof;
|
||||
arg.Tag = new Tuple<SocketAppUser, IRenderObject, LabelBase>(s.Item1, iro, s.Item3);
|
||||
arg.Tag = new Tuple<SocketAppUser, RenderObjectCore, LabelBase>(s.Item1, iro, s.Item3);
|
||||
TryDraw();
|
||||
};
|
||||
ProfileFlow.Controls.Add(con);
|
||||
@ -514,8 +473,9 @@ public class MainScreenWindow : Window
|
||||
|
||||
private GlobalSettingsMenu? gsm;
|
||||
|
||||
private Task SettingOnClicked(IRenderObject arg)
|
||||
private Task SettingOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
Console.WriteLine("SettingOnClicked");
|
||||
if (gsm is null)
|
||||
{
|
||||
gsm = new GlobalSettingsMenu();
|
||||
@ -585,12 +545,6 @@ public class MainScreenWindow : Window
|
||||
{
|
||||
CheckParent(this);
|
||||
}
|
||||
else if (e.Key == Keys.F12)
|
||||
{
|
||||
Console.WriteLine("Update Time: " + UpdateAdverage);
|
||||
Console.WriteLine("Draw Time: " + DrawAdverage);
|
||||
Console.WriteLine("Total Time: " + TotalAdverage);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<Task> LoginOnChangeToApp()
|
||||
@ -623,7 +577,6 @@ public class MainScreenWindow : Window
|
||||
Location = new(0)
|
||||
});
|
||||
ServerFlow.ForceDistanceUpdate(this);
|
||||
ServerFlow.LoadToParent(this,this);
|
||||
DrawFrame();
|
||||
|
||||
|
||||
@ -653,7 +606,7 @@ public class MainScreenWindow : Window
|
||||
{
|
||||
ServerIcon<PublicServer> si = new ServerIcon<PublicServer>(pser);
|
||||
ServerFlow.Controls.Add(si);
|
||||
si.LoadToParent(ServerFlow, this);
|
||||
//si.LoadToParent(ServerFlow, this);
|
||||
}
|
||||
|
||||
foreach (PublicServer pser in Globals.Luski.FailedServers)
|
||||
@ -661,7 +614,7 @@ public class MainScreenWindow : Window
|
||||
Console.WriteLine(pser.Name);
|
||||
ServerIcon<PublicServer> si = new ServerIcon<PublicServer>(pser, true);
|
||||
ServerFlow.Controls.Add(si);
|
||||
si.LoadToParent(ServerFlow, this);
|
||||
//si.LoadToParent(ServerFlow, this);
|
||||
}
|
||||
|
||||
AddServerIcon asi = new();
|
||||
@ -670,95 +623,14 @@ public class MainScreenWindow : Window
|
||||
|
||||
|
||||
|
||||
|
||||
if (ServerFlow.Controls.Length > 1) (ServerFlow.Controls[0] as ServerIcon<PublicServer>)!.LoadServer().Start();
|
||||
Console.WriteLine("Pre Loading");
|
||||
if (ServerFlow.Controls.Length >= 1) (ServerFlow.Controls[0] as ServerIcon<PublicServer>)!.LoadServer().Start();
|
||||
DrawFrame();
|
||||
MainShow += OnMainShow;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/*
|
||||
public override void ForceUpdate(bool resize = false)
|
||||
{
|
||||
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, SizeChanged = 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
|
||||
{
|
||||
SizeChanged = true;
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if (Controls[i].Size.X != sx && Controls[i].Size.Y != sy)
|
||||
{
|
||||
SizeChanged = true;
|
||||
}
|
||||
Controls[i].SetSize(sx, sy);
|
||||
Controls[i].SetLocation(lx, ly);
|
||||
if (UpdateDistance)
|
||||
{
|
||||
Controls[i].ForceDistanceUpdate(this);
|
||||
}
|
||||
if (Controls[i] is IParent parent && SizeChanged)
|
||||
{
|
||||
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;
|
||||
if (resize) ResizeFrameP1();
|
||||
else FrameP1();
|
||||
CheckParent(this);
|
||||
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(RenderObjectCore arg)
|
||||
{
|
||||
/* CenterFullScreenBase aso = new(new AddServerOverlayForm())
|
||||
{
|
||||
@ -768,22 +640,21 @@ public class MainScreenWindow : Window
|
||||
aso.Clicked += AsoOnClicked;
|
||||
Controls.Add(aso);
|
||||
|
||||
aso.LoadToParent(this, this);
|
||||
//aso.LoadToParent(this, this);
|
||||
GL.Scissor(0,0, CS.X, CS.Y);
|
||||
aso.Draw(0,0,0,0, CS.X, CS.Y);
|
||||
return Task.CompletedTask;
|
||||
|
||||
}
|
||||
|
||||
private Task AsoOnClicked(IRenderObject arg)
|
||||
private Task AsoOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
Globals.ms.Controls.Remove(arg);
|
||||
Globals.ms.DrawFrame();
|
||||
CenterFullScreenBase aso = (arg as CenterFullScreenBase)!;
|
||||
//AddServerOverlayld aso = (arg as AddServerOverlayld)!;
|
||||
aso.Clicked -= AsoOnClicked;
|
||||
aso.Clean();
|
||||
aso = null!;
|
||||
aso.Parent!.Controls.Remove(aso);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
using GraphicsManager;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using OpenTK.Mathematics;
|
||||
using OpenTK.Windowing.Desktop;
|
||||
using OpenTK.Windowing.Common;
|
||||
@ -60,14 +61,14 @@ public class UpdateWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
private Task NoOnClicked(IRenderObject arg)
|
||||
private Task NoOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
Result = DialogueResult.No;
|
||||
base.Close();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task YesOnClicked(IRenderObject arg)
|
||||
private Task YesOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
Result = DialogueResult.Yes;
|
||||
base.Close();
|
||||
|
@ -1,10 +1,7 @@
|
||||
using System.CodeDom.Compiler;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization.Metadata;
|
||||
@ -13,15 +10,15 @@ using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
using Luski.Classes;
|
||||
using Luski.Classes.Attribs.NumberSlider;
|
||||
using Luski.Classes.ThemeSub;
|
||||
using Luski.GUI;
|
||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
using Luski.net;
|
||||
using Luski.net.Enums;
|
||||
using Luski.net.Interfaces;
|
||||
using Luski.net.Structures.Public;
|
||||
using Luski.New.GUI;
|
||||
using Luski.Shared.PublicServers.V1.Enums;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using OpenTK.Mathematics;
|
||||
@ -35,7 +32,7 @@ public static class Globals
|
||||
#pragma warning disable CS8618
|
||||
public static List<Task<bool>> ServersLoading = new();
|
||||
public static ServerList ServerList;
|
||||
public static Dictionary<Window, List<IRenderObject>> AllowedBehindObjects = new();
|
||||
public static Dictionary<Window, List<RenderObjectCore>> AllowedBehindObjects = new();
|
||||
|
||||
public static ThemeStart Theme
|
||||
{
|
||||
@ -71,7 +68,7 @@ public static class Globals
|
||||
if (msc)
|
||||
{
|
||||
msc = false;
|
||||
mscale = Monitors.GetMonitorFromWindow(ms).HorizontalScale;
|
||||
mscale = Monitors.GetMonitorFromWindow(RootWindow).HorizontalScale;
|
||||
}
|
||||
return mscale;
|
||||
}
|
||||
@ -246,42 +243,9 @@ public static class Globals
|
||||
$"Luski.Resources.{File}");
|
||||
}
|
||||
|
||||
public static void AddBehindObject(this Window w, IRenderObject obj)
|
||||
{
|
||||
if (!AllowedBehindObjects.ContainsKey(w)) AllowedBehindObjects.Add(w, new());
|
||||
if (AllowedBehindObjects[w].Count > 0)
|
||||
{
|
||||
obj.AllowHoverFromBehind = AllowedBehindObjects[w][0].AllowHoverFromBehind;
|
||||
}
|
||||
w.Controls.Add(obj);
|
||||
AllowedBehindObjects[w].Add(obj);
|
||||
}
|
||||
|
||||
public static void ToggleBehindObjects(this Window w)
|
||||
{
|
||||
if (!AllowedBehindObjects.ContainsKey(w)) AllowedBehindObjects.Add(w, new());
|
||||
if (AllowedBehindObjects[w].Count > 0)
|
||||
{
|
||||
bool new_val = !AllowedBehindObjects[w][0].AllowHoverFromBehind;
|
||||
foreach (IRenderObject v in AllowedBehindObjects[w])
|
||||
{
|
||||
v.AllowHoverFromBehind = new_val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveBehindObject(this Window w, IRenderObject obj, bool purge = true)
|
||||
{
|
||||
if (!AllowedBehindObjects.ContainsKey(w)) AllowedBehindObjects.Add(w, new());
|
||||
AllowedBehindObjects[w].Remove(obj);
|
||||
w.Controls.Remove(obj, purge);
|
||||
obj.Clean();
|
||||
obj = null!;
|
||||
}
|
||||
|
||||
|
||||
public static bool Download { get; set; } = false;
|
||||
public static API Luski { get; } = new();
|
||||
public static RootWindow RootWindow;
|
||||
public static MainScreenWindow ms;
|
||||
|
||||
public static UserControl AddBool(IParent parent, string Name, string description, bool s, Action<bool> a, List<Label>? List = null)
|
||||
@ -313,8 +277,6 @@ public static class Globals
|
||||
if (List is not null) List.Add(l);
|
||||
tc.Size = l.Size;
|
||||
tc.Controls.Add(ts);
|
||||
ts.Location = new(parent.Size.X - ts.Size.X - 5.ScaleInt(), ll.Location.Y);
|
||||
|
||||
Rectangle TempLine = new()
|
||||
{
|
||||
Location = new(0, l.Location.Y + l.Size.Y + space),
|
||||
@ -324,9 +286,9 @@ public static class Globals
|
||||
l.Tag = TempLine;
|
||||
TempLine.Size = new(parent.Size.X - space - space, 2.ScaleInt());
|
||||
tc.SetSize(parent.Size.X, TempLine.Location.Y + TempLine.Size.Y);
|
||||
ts.Location = new(parent.Size.X - ts.Size.X - 5.ScaleInt(), ll.Location.Y);
|
||||
TempLine.ForceDistanceUpdate(tc);
|
||||
tc.Controls.Add(TempLine);
|
||||
ts.ForceDistanceUpdate(tc);
|
||||
ts.ValueChanged += @switch =>
|
||||
{
|
||||
a.Invoke(@switch.Value);
|
||||
@ -347,7 +309,7 @@ public static class Globals
|
||||
Value = val,
|
||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Right | ObjectAnchor.Left,
|
||||
BackgroundColor = new(0,0,0,0),
|
||||
Space = 10.ScaleInt()
|
||||
Space = 15.ScaleInt()
|
||||
};
|
||||
UserControl tc = new()
|
||||
{
|
||||
@ -412,7 +374,8 @@ public static class Globals
|
||||
Value = v,
|
||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Right | ObjectAnchor.Left,
|
||||
BackgroundColor = new(0,0,0,0),
|
||||
Space = 10.ScaleInt()
|
||||
Space = 15.ScaleInt(),
|
||||
Disabled = !ts.Value
|
||||
};
|
||||
UserControl tc = new()
|
||||
{
|
||||
@ -434,9 +397,9 @@ public static class Globals
|
||||
});
|
||||
tc.Size = l.Size;
|
||||
tc.Controls.Add(ts);
|
||||
ts.Location = new(parent.Size.X - ts.Size.X - 5.ScaleInt(), ll.Location.Y);
|
||||
|
||||
tc.Controls.Add(NumberSelector);
|
||||
NumberSelector.Location = new(5.ScaleInt(), l.Location.Y + l.Size.Y + space);
|
||||
NumberSelector.Location = new(space, l.Location.Y + l.Size.Y + space);
|
||||
|
||||
Rectangle TempLine = new()
|
||||
{
|
||||
@ -447,6 +410,7 @@ public static class Globals
|
||||
l.Tag = TempLine;
|
||||
TempLine.Size = new(parent.Size.X - space - space, 2.ScaleInt());
|
||||
tc.SetSize(parent.Size.X, TempLine.Location.Y + TempLine.Size.Y);
|
||||
ts.Location = new(parent.Size.X - ts.Size.X - 5.ScaleInt(), ll.Location.Y);
|
||||
NumberSelector.SetSize(TempLine.Size.X, 0);
|
||||
NumberSelector.SetLocation(TempLine.Location.X, NumberSelector.Location.Y);
|
||||
NumberSelector.ForceDistanceUpdate(tc);
|
||||
@ -455,6 +419,7 @@ public static class Globals
|
||||
ts.ForceDistanceUpdate(tc);
|
||||
ts.ValueChanged += @switch =>
|
||||
{
|
||||
NumberSelector.Disabled = !@switch.Value;
|
||||
if (@switch.Value)
|
||||
{
|
||||
a.Invoke(defaul);
|
||||
@ -668,7 +633,7 @@ public static class Globals
|
||||
return name;
|
||||
}
|
||||
|
||||
public static async Task<IRenderObject> MakeRct<TUser>(this ServerProfile Profile, TUser User, Vector2i Size) where TUser : SocketUser
|
||||
public static async Task<RenderObjectCore> MakeRct<TUser>(this ServerProfile Profile, TUser User, Vector2i Size) where TUser : SocketUser
|
||||
{
|
||||
Texture t = ms.TextureManager.GetTextureResource("Status.png");
|
||||
if (Profile.PictureType == PictureType.none)
|
||||
@ -698,7 +663,7 @@ public static class Globals
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<IRenderObject> MakeRct(this PublicServer Server, Vector2i Size)
|
||||
public static async Task<RenderObjectCore> MakeRct(this PublicServer Server, Vector2i Size)
|
||||
{
|
||||
Texture t = ms.TextureManager.GetTextureResource("rc.png");
|
||||
if (Server.PictureType == PictureType.none)
|
||||
@ -707,6 +672,7 @@ public static class Globals
|
||||
r.Size = Size;
|
||||
r.Shader = Rectangle.DefaultAlphaShader[ms.Context];
|
||||
r.BackgroundColor = new(25, 25, 25, 255);
|
||||
if (string.IsNullOrEmpty(Server.Name)) return r;
|
||||
Label l = new(DefaultFont)
|
||||
{
|
||||
Color = new(255,255,255,255),
|
||||
|
@ -1,8 +1,9 @@
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects.Core;
|
||||
|
||||
namespace Luski.Interfaces;
|
||||
|
||||
public interface IThemeObject
|
||||
{
|
||||
public IRenderObject MakeObject(params object[] param);
|
||||
public RenderObjectCore MakeObject(params object[] param);
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<FileVersion>0.0.0.1</FileVersion>
|
||||
@ -22,7 +22,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GraphicsManager" Version="1.1.1-alpha36" />
|
||||
<PackageReference Include="GraphicsManager" Version="1.1.1-alpha60" />
|
||||
<PackageReference Include="Luski.net" Version="2.0.1-alpha18" />
|
||||
<PackageReference Include="Updater" Version="1.0.0-alpha05" />
|
||||
</ItemGroup>
|
||||
|
0
Luski/Luski.ico
Executable file → Normal file
0
Luski/Luski.ico
Executable file → Normal file
Before (image error) Size: 39 KiB After (image error) Size: 39 KiB |
209
Luski/New/GUI/RootWindow.cs
Normal file
209
Luski/New/GUI/RootWindow.cs
Normal file
@ -0,0 +1,209 @@
|
||||
using GraphicsManager.Enums;
|
||||
using GraphicsManager.Interfaces;
|
||||
using GraphicsManager.Objects;
|
||||
using GraphicsManager.Objects.Core;
|
||||
using GraphicsManager.Objects.Core.Fonts;
|
||||
using Luski.GUI.MainScreen.UI.Generic;
|
||||
using Luski.GUI.MainScreen.UI.LuskiControls;
|
||||
using Luski.GUI.MainScreen.UI.LuskiSettings;
|
||||
using Luski.GUI.MainScreen.UI.PublicServers;
|
||||
using OpenTK.Audio.OpenAL;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
using OpenTK.Mathematics;
|
||||
using OpenTK.Windowing.Common;
|
||||
using OpenTK.Windowing.Desktop;
|
||||
using OpenTK.Windowing.GraphicsLibraryFramework;
|
||||
using All = OpenTK.Platform.Windows.All;
|
||||
using Window = GraphicsManager.Window;
|
||||
|
||||
namespace Luski.New.GUI;
|
||||
|
||||
public class RootWindow : Window
|
||||
{
|
||||
private static readonly NativeWindowSettings Settings = new()
|
||||
{
|
||||
Title = "Luski",
|
||||
WindowBorder = WindowBorder.Resizable,
|
||||
APIVersion = new(3, 2),
|
||||
API = ContextAPI.OpenGL,
|
||||
StartFocused = true,
|
||||
ClientSize = new(1920, 1080),
|
||||
Icon = Globals.Icon,
|
||||
SharedContext = null
|
||||
};
|
||||
|
||||
private ServerFlow ServerFlow;
|
||||
private ChannelSelector ChannelSelector;
|
||||
private PublicChat PublicChat;
|
||||
private UserControl ServerTitle;
|
||||
|
||||
public RootWindow()
|
||||
: base(Settings)
|
||||
{
|
||||
base.UseSubFrames = false;
|
||||
base.UseLiveView = false;
|
||||
base.CustomF11 = false;
|
||||
|
||||
#region Fonts
|
||||
|
||||
Globals.RootWindow = this;
|
||||
try
|
||||
{
|
||||
Globals.DefaultFontFamly = FontFamily.LoadFontFamily(Globals.GetResource("Fonts.OpenSans.zip"), "OpenSans");
|
||||
Globals.DefaultFont = FontInteraction.Load(Globals.DefaultFontFamly);
|
||||
string fams = Path.Combine(Globals.LuskiPath, "FontFamilies");
|
||||
if (!Directory.Exists(fams)) Directory.CreateDirectory(fams);
|
||||
DirectoryInfo di = new DirectoryInfo(fams);
|
||||
|
||||
foreach (FileInfo fam in di.GetFiles())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (fam.FullName.ToLower().EndsWith(".zip"))
|
||||
Globals.DefaultFont.AddFamily(FontFamily.LoadFontFamily(File.Open(fam.FullName, FileMode.Open), fam.Name));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
|
||||
Globals.DefaultFont.PixelHeight = Globals.Settings.DefaultFontPX.ScaleFont();
|
||||
Globals.DefaultFont.FontSize = FontSize.Regular;
|
||||
Globals.TopTimeFont = Globals.DefaultFont.Clone();
|
||||
Globals.TopTimeFont.PixelHeight = Globals.Settings.TopTimeFontPX.ScaleFont();
|
||||
Globals.TopTimeFont.FontSize = FontSize.Regular;
|
||||
Globals.ServerRoleFont = Globals.DefaultFont.Clone();
|
||||
Globals.ServerRoleFont.PixelHeight = Globals.Settings.RoleSettingsFontPX.ScaleFont();
|
||||
Globals.ServerRoleFont.FontSize = FontSize.Regular;
|
||||
Globals.MessageFont = Globals.DefaultFont.Clone();
|
||||
Globals.MessageFont.PixelHeight = Globals.Settings.MessageFontPX.ScaleFont();
|
||||
Globals.MessageFont.ExtraLinePixels = Globals.Settings.MessageFontLineSpacePX.ScaleFont();
|
||||
Globals.MessageFont.FontSize = FontSize.Regular;
|
||||
Globals.SmallTimeFont = Globals.DefaultFont.Clone();
|
||||
Globals.SmallTimeFont.PixelHeight = ((uint)11).ScaleFont();
|
||||
Globals.LuskiTexture = TextureManager.GetTextureResource("Luski.png");
|
||||
|
||||
#endregion
|
||||
|
||||
ServerFlow = new()
|
||||
{
|
||||
BackgroundColor = new(26, 26, 26, 255),
|
||||
Size = new(68.ScaleInt(), CS.Y-52.ScaleInt()),
|
||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom
|
||||
};
|
||||
ServerTitle = new()
|
||||
{
|
||||
Location = new(ServerFlow.Size.X, 0),
|
||||
Size = new(307.ScaleInt(), 46.ScaleInt()),
|
||||
BackgroundColor = new(30, 30, 30, 255)
|
||||
};
|
||||
ChannelSelector = new()
|
||||
{
|
||||
BackgroundColor = new(34, 34, 34, 255),
|
||||
Location = new(ServerFlow.Size.X, ServerTitle.Size.Y + 2.ScaleInt()),
|
||||
Size = new(ServerTitle.Size.X, CS.Y - 54.ScaleInt() - ServerTitle.Size.Y),
|
||||
Anchor = ObjectAnchor.Top | ObjectAnchor.Left | ObjectAnchor.Bottom
|
||||
};
|
||||
PublicChat = new()
|
||||
{
|
||||
Location = new(ChannelSelector.Size.X + ServerFlow.Size.X, 0),
|
||||
Size = new(Size.X - ChannelSelector.Size.X - ServerFlow.Size.X, CS.Y),
|
||||
Anchor = ObjectAnchor.All
|
||||
};
|
||||
Rectangle setting = new(TextureManager.GetTextureResource("settings.png"))
|
||||
{
|
||||
Location = new(18.ScaleInt(), ServerFlow.Size.Y + 10.ScaleInt()),
|
||||
Size = new(32.ScaleInt()),
|
||||
Shader = Rectangle.DefaultAlphaShader[Context],
|
||||
BackgroundColor = Color4.Gray,
|
||||
Anchor = ObjectAnchor.Bottom | ObjectAnchor.Left,
|
||||
BlendOverride = true
|
||||
};
|
||||
setting.MouseEnter += _ =>
|
||||
{
|
||||
setting.BackgroundColor = Color4.White;
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
setting.MouseLeave += _ =>
|
||||
{
|
||||
setting.BackgroundColor = Color4.Gray;
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
setting.Clicked += SettingOnClicked;
|
||||
Controls.Add(setting);
|
||||
Controls.Add(ServerFlow);
|
||||
Controls.Add(ServerTitle);
|
||||
Controls.Add(ChannelSelector);
|
||||
Controls.Add(PublicChat);
|
||||
}
|
||||
|
||||
private GlobalSettingsMenu? gsm;
|
||||
|
||||
private Task SettingOnClicked(RenderObjectCore arg)
|
||||
{
|
||||
Console.WriteLine("SettingOnClicked");
|
||||
gsm ??= new();
|
||||
Controls.Add(gsm);
|
||||
Globals.RootWindow.DrawFrame();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(KeyboardKeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
if (e.Key == Keys.F4)
|
||||
{
|
||||
if (!Context.IsCurrent) Context.MakeCurrent();
|
||||
Context.SwapBuffers();
|
||||
Console.WriteLine($"Force Swap");
|
||||
}
|
||||
else if (e.Key == Keys.F5)
|
||||
{
|
||||
ForceUpdate();
|
||||
}
|
||||
else if (e.Key == Keys.F8)
|
||||
{
|
||||
if (focused is null)
|
||||
{
|
||||
Console.WriteLine("There is not focused object");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Focused objet: {focused}\n\tLocation: {focused.Location}\n\tSize: {focused.Size}");
|
||||
}
|
||||
}
|
||||
else if (e.Key == Keys.F7)
|
||||
{
|
||||
if (HoveringControl is null)
|
||||
{
|
||||
Console.WriteLine("There is not hovering object");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Hovering objet: {HoveringControl}\n\tLocation: {HoveringControl.Location}\n\tSize: {HoveringControl.Size}");
|
||||
}
|
||||
}
|
||||
else if (e.Key == Keys.F9)
|
||||
{
|
||||
if (HoveringControl is IParent p)
|
||||
{
|
||||
Globals.PrintParent(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals.PrintParent(this);
|
||||
}
|
||||
}
|
||||
else if (e.Key == Keys.F10)
|
||||
{
|
||||
CheckParent(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -10,11 +10,7 @@ using Image = OpenTK.Windowing.Common.Input.Image;
|
||||
|
||||
try
|
||||
{
|
||||
Console.WriteLine("App Running");
|
||||
GLFW.SetErrorCallback(null);
|
||||
Console.WriteLine("STOP ErrorCallback");
|
||||
Globals.Settings = Globals.GetSettings(Path.Combine(Globals.LuskiPath, "Settings.json"), SettingsContext.Default.Settings);
|
||||
Console.WriteLine("load settings");
|
||||
foreach (ExperimentInfo le in LuskiExperiments.LuskiExperimentsList)
|
||||
{
|
||||
Globals.RegisterExperiment(le);
|
||||
@ -55,7 +51,6 @@ try
|
||||
switch (server.Main)
|
||||
{
|
||||
case false:
|
||||
// if (server.Domain == "jt.luskiserver.jacobtech.com") continue;
|
||||
Globals.ServersLoading.Add(Task.Run(async () =>
|
||||
{
|
||||
return await Globals.Luski.TryGetPublicServer(out _, server.Domain, server.Version,
|
||||
@ -68,7 +63,6 @@ try
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine("Servers found");
|
||||
Globals.UpdaterSettings = Globals.GetSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings);
|
||||
Image<Rgba32> Logo = SixLabors.ImageSharp.Image.Load<Rgba32>(Globals.GetResource("Textures.Luski.png"));
|
||||
Logo.DangerousTryGetSinglePixelMemory(out Memory<Rgba32> m);
|
||||
@ -102,16 +96,14 @@ try
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine("icon");
|
||||
MainScreenWindow.Settings.Icon = Globals.Icon;
|
||||
|
||||
Globals.ms = new MainScreenWindow();
|
||||
Globals.ms.CustomF11 = false;
|
||||
|
||||
Globals.RootWindow = new();
|
||||
//Globals.ms.DrawFrame();
|
||||
pixels = Array.Empty<byte>();
|
||||
Globals.ms.StartRender();
|
||||
Globals.ms.Dispose();
|
||||
|
||||
pixels = [];
|
||||
Globals.RootWindow.StartRender();
|
||||
Globals.RootWindow.Dispose();
|
||||
Thread.Sleep(-1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Reference in New Issue
Block a user