|
|
using ImGuiNET;
|
|
|
|
|
|
using Num = System.Numerics;
|
|
|
|
|
|
using isometricparkfna.Messages;
|
|
|
using isometricparkfna.Engines;
|
|
|
|
|
|
namespace isometricparkfna.UI
|
|
|
{
|
|
|
|
|
|
public static class ForestWindow
|
|
|
{
|
|
|
public static void Render(bool show, ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine)
|
|
|
{
|
|
|
bool newShow = show;
|
|
|
if (show)
|
|
|
{
|
|
|
ImGui.PushFont(font);
|
|
|
|
|
|
ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None;
|
|
|
StyleSet.pushStyleVarSet(StyleSet.defaultWindowVars);
|
|
|
StyleSet.pushColorSet(StyleSet.defaultWindowColors);
|
|
|
|
|
|
ImGui.Begin("Forest Policy", ref show, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings);
|
|
|
|
|
|
|
|
|
int new_tree_planting = sim.tree_planting;
|
|
|
ImGui.SliderInt("Tree Planting ", ref new_tree_planting, 0, Simulation.MAX_TREES_TO_PLANT, string.Format("%d (${0})", new_tree_planting*Simulation.TREE_PLANT_COST));
|
|
|
sim.tree_planting = new_tree_planting;
|
|
|
|
|
|
int new_tree_clearing = sim.tree_clearing;
|
|
|
ImGui.SliderInt("Tree Clearing", ref new_tree_clearing, 0, Simulation.MAX_TREES_TO_CLEAR, string.Format("%d (${0})", new_tree_clearing*Simulation.TREE_CLEAR_COST));
|
|
|
sim.tree_clearing = new_tree_clearing;
|
|
|
|
|
|
ImGui.Text(string.Format("Crowded Trees: {0}", sim.crowded_trees ));
|
|
|
ImGui.Text(string.Format("Percent Healthy Trees: {0:F2}", sim.healthy_percent));
|
|
|
ImGui.Text(string.Format("Average Age of Trees: {0:F2}", sim.average_tree_age));
|
|
|
ImGui.Text(string.Format("Max Age of Trees: {0:F2}", sim.max_tree_age));
|
|
|
|
|
|
if (ImGui.Button("Okay"))
|
|
|
{
|
|
|
show = false;
|
|
|
}
|
|
|
|
|
|
ImGui.End();
|
|
|
ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left;
|
|
|
// ImGui.PopStyleVar(3);
|
|
|
// ImGui.PopStyleColor(8);
|
|
|
StyleSet.popStyleVarSet(StyleSet.defaultWindowVars);
|
|
|
StyleSet.popColorSet(StyleSet.defaultWindowColors);
|
|
|
ImGui.PopFont();
|
|
|
}
|
|
|
if (show != newShow)
|
|
|
{
|
|
|
engine.typeMessages.Add(new ToggleWindowTypeMessage {Window = Window.Forest });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|