add
This commit is contained in:
parent
b67c131150
commit
7e71d2f938
1 changed files with 56 additions and 2 deletions
|
@ -1,6 +1,60 @@
|
||||||
namespace ZoFo.GameCore.GUI;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Xml;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using MonogameLibrary.UI.Base;
|
||||||
|
using MonogameLibrary.UI.Elements;
|
||||||
|
|
||||||
|
namespace ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
public abstract class AbstractGUI
|
public abstract class AbstractGUI
|
||||||
{
|
{
|
||||||
|
protected UIManager Manager = new();
|
||||||
|
protected List<DrawableUIElement> Elements = new();
|
||||||
|
private List<DrawableUIElement> ActiveElements;
|
||||||
|
protected DrawableUIElement SelectedElement;
|
||||||
|
private bool isStartedPrint = false;
|
||||||
|
private bool isPressed = false;
|
||||||
|
|
||||||
|
public AbstractGui()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void CreateUI();
|
||||||
|
private GraphicsDevice graphicsDevice;
|
||||||
|
public virtual void Initialize()
|
||||||
|
{
|
||||||
|
Manager.Initialize(AppManager.Instance.GraphicsDevice);
|
||||||
|
CreateUI();
|
||||||
|
ActiveElements = new List<DrawableUIElement>();
|
||||||
|
foreach (var element in Elements)
|
||||||
|
{
|
||||||
|
if (CheckOnBadElements(element))
|
||||||
|
{
|
||||||
|
ActiveElements.Add(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ActiveElements.Count > 0) { SelectedElement = ActiveElements.First(); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void LoadContent()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
Manager.Draw(spriteBatch);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue