Hlavní menu, synchronizace jmen hráčů. Client hru spustí až ve chvíli kdy dostane správný packet. Oprava bugu v se scalováním UIElementu

This commit is contained in:
Perry 2026-03-11 22:35:30 +01:00
parent e6128dc9f5
commit 7656707177
19 changed files with 315 additions and 53 deletions

View file

@ -27,9 +27,8 @@ public class Screen {
if (CurrentScreen.temporary){
Screens.Remove(CurrentScreen.Label);
}
else if (CurrentScreen != null){
CurrentScreen.Active = false;
}
CurrentScreen.Active = false;
CurrentScreen = Screens[id];
CurrentScreen.Active = true;
}
@ -40,14 +39,20 @@ public class Screen {
public static void UpdateAll() {
foreach (var screen in Screens.Values){
// if (!screen.Active) continue;
if (!screen.Active) continue;
screen.Update();
}
}
public static Screen Empty => new(""){temporary = true};
public static void SetOverlayScreen(string id) {
if (OverlayScreen.temporary){
Screens.Remove(OverlayScreen.Label);
}
OverlayScreen.Active = false;
OverlayScreen = Screens[id];
OverlayScreen.Active = true;
}
public static void DisableOverlay() {
@ -80,8 +85,9 @@ public class Screen {
public UIElement this[string id] => elements[id];
public UIElement TryGetElement(string id) => elements.TryGetValue(id, out var val) ? val : null;
public void AddElement(string id, UIElement element) {
public UIElement AddElement(string id, UIElement element) {
elements.Add(id, element);
return element;
}
public void SetActive(bool active) {