|
|
using ImGuiNET;
|
|
|
|
|
|
using Num = System.Numerics;
|
|
|
|
|
|
using isometricparkfna.Engines;
|
|
|
using isometricparkfna.Messages;
|
|
|
|
|
|
namespace isometricparkfna.UI
|
|
|
{
|
|
|
|
|
|
public static class Menu
|
|
|
{
|
|
|
|
|
|
public const int MENU_BAR_HEIGHT = 20;
|
|
|
|
|
|
private static bool activeButton(string label, bool active, Num.Vector4 activeColor, Num.Vector4 activeTextColor) {
|
|
|
|
|
|
if (active) {
|
|
|
ImGui.PushStyleColor(ImGuiCol.Button, activeColor);
|
|
|
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, activeColor);
|
|
|
ImGui.PushStyleColor(ImGuiCol.Text, activeTextColor);
|
|
|
}
|
|
|
|
|
|
var result = ImGui.Button(label);
|
|
|
|
|
|
if (active) {
|
|
|
ImGui.PopStyleColor(3);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
public static void Render(ImFontPtr font, int width, ImGuiWindowBridgeEngine bridgeEngine, ref bool quit, ref bool paused, ref int rate, ref bool showBudget, string header)
|
|
|
{
|
|
|
ImGui.PushFont(font);
|
|
|
|
|
|
ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None;
|
|
|
|
|
|
|
|
|
StyleSets.defaultSet.push();
|
|
|
ImGui.PushStyleColor(ImGuiCol.MenuBarBg, StyleSets.grey);
|
|
|
|
|
|
if (ImGui.BeginMainMenuBar())
|
|
|
{
|
|
|
|
|
|
ImGui.Text(header);
|
|
|
|
|
|
ImGui.SetCursorPosX(width - 520);
|
|
|
|
|
|
if (Menu.activeButton("\ue0c2 Contracts", bridgeEngine.windowStatuses[Window.Contracts], StyleSets.selected, StyleSets.white))
|
|
|
{
|
|
|
Logging.Trace("Contracts toggled.");
|
|
|
Logging.Spy(bridgeEngine.windowStatuses, "statuses");
|
|
|
bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.Contracts});
|
|
|
}
|
|
|
//Budget isn't connected to an entity yet:
|
|
|
if (Menu.activeButton("$ Budget", showBudget, StyleSets.selected, StyleSets.white))
|
|
|
{
|
|
|
bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.Budget});
|
|
|
|
|
|
}
|
|
|
if (Menu.activeButton("\ue124 Forest", bridgeEngine.windowStatuses[Window.Forest], StyleSets.selected, StyleSets.white))
|
|
|
{
|
|
|
bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.Forest});
|
|
|
|
|
|
}
|
|
|
if (Menu.activeButton("\ue0bf News", bridgeEngine.windowStatuses[Window.News], StyleSets.selected, StyleSets.white))
|
|
|
{
|
|
|
bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.News});
|
|
|
}
|
|
|
|
|
|
ImGui.Text("|");
|
|
|
|
|
|
if (Menu.activeButton("\ue0ac Pause", paused, StyleSets.selected, StyleSets.white ))
|
|
|
{
|
|
|
paused = !paused;
|
|
|
}
|
|
|
if (Menu.activeButton("1", (rate == 0), StyleSets.selected, StyleSets.white))
|
|
|
{
|
|
|
paused = false;
|
|
|
rate = 0;
|
|
|
}
|
|
|
else if (Menu.activeButton("2", (rate == 1), StyleSets.selected, StyleSets.white))
|
|
|
{
|
|
|
paused = false;
|
|
|
rate = 1;
|
|
|
}
|
|
|
else if (Menu.activeButton("3", (rate == 2), StyleSets.selected, StyleSets.white))
|
|
|
{
|
|
|
paused = false;
|
|
|
rate = 2;
|
|
|
}
|
|
|
else if (Menu.activeButton("4", (rate == 3), StyleSets.selected, StyleSets.white))
|
|
|
{
|
|
|
paused = false;
|
|
|
rate = 3;
|
|
|
}
|
|
|
#if DEBUG
|
|
|
else if (Menu.activeButton("5", (rate == 4), StyleSets.selected, StyleSets.white))
|
|
|
{
|
|
|
paused = false;
|
|
|
rate = 4;
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
|
|
|
ImGui.EndMainMenuBar();
|
|
|
|
|
|
ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left;
|
|
|
|
|
|
StyleSets.defaultSet.pop();
|
|
|
ImGui.PopStyleColor(1);
|
|
|
ImGui.PopFont();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|