Rozsvěcení a zhasínání světel, sprity pro místnosti, indikátory rozsvícených světel, po konci hry je hráč vrácen do hlavního menu
This commit is contained in:
parent
25a62af483
commit
55fd052072
27 changed files with 338 additions and 113 deletions
|
|
@ -68,6 +68,8 @@ public class Screen {
|
|||
|
||||
public string Label{ get; }
|
||||
private Dictionary<string, UIElement> elements = new();
|
||||
private List<UIElement> elementsInDrawOrder = new();
|
||||
|
||||
public bool Active { get; private set; } = false;
|
||||
private InputListenerHook mouseInputHook = new(true);
|
||||
private bool temporary = false;
|
||||
|
|
@ -87,6 +89,15 @@ public class Screen {
|
|||
|
||||
public UIElement AddElement(string id, UIElement element) {
|
||||
elements.Add(id, element);
|
||||
|
||||
int insertIndex = elementsInDrawOrder.FindLastIndex(e => e.DrawPriority == element.DrawPriority);
|
||||
if (insertIndex == -1){
|
||||
elementsInDrawOrder.Add(element);
|
||||
}
|
||||
else{
|
||||
elementsInDrawOrder.Insert(insertIndex + 1, element);
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +131,7 @@ public class Screen {
|
|||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch) {
|
||||
foreach (var val in elements.Values){
|
||||
foreach (var val in elementsInDrawOrder){
|
||||
val.Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue