Přidán build script, předělaná struktura, funkční spouštění serveru z clienta. Client je schopen fungovat po více her bez restartu. Bugfixy
This commit is contained in:
parent
c942d23a87
commit
1a27dd6fab
22 changed files with 269 additions and 136 deletions
|
|
@ -73,6 +73,8 @@ public class Screen {
|
|||
public bool Active { get; private set; } = false;
|
||||
private InputListenerHook mouseInputHook = new(true);
|
||||
private bool temporary = false;
|
||||
|
||||
private List<string> temporaryElements = new();
|
||||
|
||||
public Screen(string label) {
|
||||
Label = label;
|
||||
|
|
@ -87,7 +89,7 @@ public class Screen {
|
|||
public UIElement this[string id] => elements[id];
|
||||
public UIElement TryGetElement(string id) => elements.TryGetValue(id, out var val) ? val : null;
|
||||
|
||||
public UIElement AddElement(string id, UIElement element) {
|
||||
public UIElement AddElement(string id, UIElement element, bool temporary = false) {
|
||||
elements.Add(id, element);
|
||||
|
||||
int insertIndex = elementsInDrawOrder.FindLastIndex(e => e.DrawPriority == element.DrawPriority);
|
||||
|
|
@ -97,10 +99,25 @@ public class Screen {
|
|||
else{
|
||||
elementsInDrawOrder.Insert(insertIndex + 1, element);
|
||||
}
|
||||
|
||||
if (temporary){
|
||||
temporaryElements.Add(id);
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
public void RemoveElement(string id) {
|
||||
if (!elements.ContainsKey(id)) return;
|
||||
elements.Remove(id, out var element);
|
||||
elementsInDrawOrder.RemoveAll(e => e == element);
|
||||
}
|
||||
|
||||
public void RemoveTemporary() {
|
||||
temporaryElements.ForEach(RemoveElement);
|
||||
temporaryElements.Clear();
|
||||
}
|
||||
|
||||
public void SetActive(bool active) {
|
||||
Active = active;
|
||||
if (Active == active) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue