Files
CalamityModPublic/UI/PopupGUIManager.cs
T
DominicKarma42 fd1662d743 Lots of Arsenal things. See description.
Added Draedon weapon chargers and generators. As of pushing this, it uses dirt blocks as fuel. This will be changed when a sprite and name are decided for the actual fuel. These have been roughly tested in Multiplayer. No remaining bugs exist to my knowledge.

Added a schematic worldgen system. There are two .cs files that they use with autogenerated code. Please excuse their poor quality.

Added a rough base for pop GUIs (for book-reading and the like. A draedons logbook exists that uses this)

Adjusted Snake eyes to use a little less dust.

Note: This is NOT ready to be merged into master yet. A lot of placeholders are used.
2020-06-15 17:30:39 -05:00

46 lines
1.4 KiB
C#

using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
using System.Linq;
namespace CalamityMod.UI
{
public static class PopupGUIManager
{
private static readonly List<PopupGUI> gUIs = new List<PopupGUI>();
public static DraedonsLogUI DraedonLogGUI;
public static bool GUIActive(PopupGUI gui) => gui.Active || gui.FadeTime > 0;
public static bool AnyGUIsActive => gUIs.Any(GUIActive);
public static PopupGUI GetActiveGUI => gUIs.FirstOrDefault(GUIActive);
public static void SuspendAll()
{
DraedonLogGUI.Active = false;
}
public static void UpdateAndDraw(SpriteBatch spriteBatch)
{
if (AnyGUIsActive)
{
GetActiveGUI.Update();
if (GetActiveGUI == null)
return;
if (GetActiveGUI.FadeTime == 1 && !GetActiveGUI.Active)
{
spriteBatch.End();
spriteBatch.Begin();
return;
}
GetActiveGUI.Draw(spriteBatch);
}
}
public static void LoadGUIs()
{
DraedonLogGUI = new DraedonsLogUI();
gUIs.Add(DraedonLogGUI);
}
public static void UnloadGUIs()
{
DraedonLogGUI = null;
gUIs.Clear();
}
}
}