Compare commits

..

No commits in common. "77ec87d795788367d4e62663d1f109dc9e738957" and "f7abb6e993da95d34658224d290ab8e6103be64d" have entirely different histories.

8 changed files with 13 additions and 47 deletions

View File

@ -82,7 +82,6 @@ public class AccountButton : UserControl
SM.Selected = this;
SM.page.Controls.Clear();
OnPageLoad.Invoke();
Globals.ms.ForceUpdate(new(Globals.ms.CS));
}
BlockDraw = false;

View File

@ -27,9 +27,11 @@ public class AddServerOverlay : UserControl, IServerOverlay
public AddServerOverlay()
{
base.Size = Globals.ms.ClientSize;
base.BackgroundColor = new(0, 0, 0, 130);
BackgroundColor = new(0, 0, 0, 130);
Anchor = ObjectAnchor.All;
Form = new(Globals.ms.TextureManager.GetTextureResource("RoundedRectangle.png"))
{
Size = new(350.ScaleInt(), 347.ScaleInt()),
@ -335,6 +337,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
DisplayName.Textures[0] = UserName.Textures[0];
rec.ForceDistanceUpdate(page);
Globals.ms.TryDraw();
Globals.ms.ForceUpdate(new(Size));
}
};
ca.Size = new((Form.Size.X - tb.Location.X - tb.Location.X - (tb.Location.X / 2)) / 2, ca.Size.Y);
@ -393,7 +396,6 @@ public class AddServerOverlay : UserControl, IServerOverlay
return Task.CompletedTask;
};
UserName.Size = UserName.Size;
page.Controls.Add(Password = new()
{
@ -441,12 +443,8 @@ public class AddServerOverlay : UserControl, IServerOverlay
return Task.CompletedTask;
};
Password.Size = Password.Size;
Password.ForceDistanceUpdate(page);
DisplayName = null!;
rec = null!;
Globals.ms.ForceUpdate(new(Globals.ms.CS));
TryDraw();
}
};
lo.Size = ca.Size;
@ -556,6 +554,7 @@ public class AddServerOverlay : UserControl, IServerOverlay
Globals.ms.ser.Controls.Insert(Globals.ms.ser.Controls.Length - 1, ss);
await ss.LoadServer();
Globals.ms.Controls.Remove(this);
Globals.ms.ForceUpdate(new(Size));
Globals.ms.TryDraw();
}

View File

@ -115,9 +115,7 @@ public class Channel : UserControl
Console.WriteLine("Waiting");
Task.WaitAll(mm);
Globals.ms.pc.MessageFlow.ForceScrollUpdate();
if (Globals.ms.pc.MessageFlow.Controls.Length > 1 && Globals.ms.pc.MessageFlow.Controls[Globals.ms.pc.MessageFlow.Controls.Length - 1].Location.Y + Globals.ms.pc.MessageFlow.Controls[Globals.ms.pc.MessageFlow.Controls.Length - 1].Size.Y > Globals.ms.pc.MessageFlow.Size.Y)
Globals.ms.pc.MessageFlow.ScrollToBottom();
else Globals.ms.pc.MessageFlow.ScrollToTop();
Console.WriteLine("Done");
}
BlockDraw = false;

View File

@ -1,5 +1,4 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
using GraphicsManager.Enums;
using GraphicsManager.Interfaces;
using GraphicsManager.Objects;
@ -8,7 +7,6 @@ using Luski.net.Structures.Main;
using Luski.net.Structures.Public;
using OpenTK.Mathematics;
using OpenTK.Windowing.Common.Input;
using OpenTK.Windowing.GraphicsLibraryFramework;
using Label = GraphicsManager.Objects.Label;
namespace Luski.GUI.MainScreen.UI.PublicServers;
@ -99,17 +97,6 @@ public class ChatMessage : UserControl
Label l;
Controls.Add(l = new Label(Globals.MessageFont) { Location = new(LastObject.Location.X, (int)(UserIcon.Location.Y + UserIcon.Size.Y - Globals.MessageFont.PixelHeight), 0), Text = message.Context});
LastObject = l;
LuskiContextMenu lcm = new();
Label llllll = lcm.AddLabel("Copy Text");
unsafe
{
llllll.Clicked += (o) =>
{
GLFW.SetClipboardString(Globals.ms.WindowPtr, message.Context);
return Task.CompletedTask;
};
}
l.ContextMenu = lcm;
MessageObjs.Add(l);
}
Globals.Settings.DayTimeChanged += () =>
@ -209,17 +196,6 @@ public class ChatMessage : UserControl
Controls.Add(newLabel);
MessageObjs.Add(newLabel);
LastObject = newLabel;
LuskiContextMenu lcm = new();
Label llllll = lcm.AddLabel("Copy Text");
unsafe
{
llllll.Clicked += (o) =>
{
GLFW.SetClipboardString(Globals.ms.WindowPtr, msg.Context);
return Task.CompletedTask;
};
}
newLabel.ContextMenu = lcm;
}

View File

@ -402,7 +402,6 @@ public class PublicChat : UserControl
public void ClearChat()
{
MessageFlow.Controls.Clear();
MessageFlow.ScrollValue = 0;
MessageFlow.ScrollUpdatesInterval = 33;
lastm = null;
lastUser = null;

View File

@ -13,21 +13,17 @@ public class ServerIcon<TServer> : UserControl where TServer : Server
private Rectangle SelectedRect;
private static ServerIcon<MainServer>? ser1;
private static ServerIcon<PublicServer>? ser2;
private bool Selected = false;
public async Task LoadServer()
{
Selected = true;
if (ser1 is not null)
{
ser1.SelectedRect.BackgroundColor = new(26, 26, 26, 255);
ser1.Selected = false;
ser1 = null;
}
if (ser2 is not null)
{
ser2.SelectedRect.BackgroundColor = new(26, 26, 26, 255);
ser2.Selected = false;
ser2 = null;
}
@ -84,7 +80,6 @@ public class ServerIcon<TServer> : UserControl where TServer : Server
private async Task OnClicked(IRenderObject arg)
{
if (Selected) return;
await LoadServer();
}

View File

@ -298,6 +298,8 @@ public class SettingsMenu : UserControl
});
TextBox t;
page!.Controls.Add(t =new TextBox()
{
@ -342,7 +344,7 @@ public class SettingsMenu : UserControl
{
var e = Enum.Parse(PropType, (v - va).ToString());
PropVal = e;
prop.SetValue(Globals.UpdaterSettings, e);
prop.SetValue(Globals.Settings, e);
}
Globals.UpdaterSettings.SaveSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings);
});
@ -362,7 +364,7 @@ public class SettingsMenu : UserControl
string description = ((DescriptionAttribute)valueAttributes[0]).Description;
AddBool(description, (bool)PropVal, b =>
{
prop.SetValue(Globals.UpdaterSettings, b);
prop.SetValue(Globals.Settings, b);
Globals.UpdaterSettings.SaveSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings);
});
}
@ -371,7 +373,6 @@ public class SettingsMenu : UserControl
// ignored
}
}
}
t.ForceDistanceUpdate(page);
@ -381,8 +382,7 @@ public class SettingsMenu : UserControl
Globals.UpdaterSettings.SaveSettings(Path.Combine(Globals.LuskiPath, "UpdaterSettings.json"), UpdaterSettingsContext.Default.UpdaterSettings);
return Task.CompletedTask;
};
TryDraw();
Globals.ms.ForceUpdate(new(Globals.ms.CS));
Globals.ms.ForceUpdate(new(Globals.ms.ClientSize));
}
};
As.AddButton(cb);

View File

@ -396,7 +396,7 @@ public class MainScreenWindow : Window
Controls.Add(aso);
TryDraw();
OnResize(new(CS));
OnResize(new(Size));
return Task.CompletedTask;
}