diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -882,8 +882,10 @@ if (this.showNews) { NewsWindow.Render(ref this.showNews, debugWindow.monoFont, this.simulation, - new[] {new NewsItem{hed="test", contents="MILWAUKEE - This is where the lede would go."}, - new NewsItem{hed="Politicians Debate Stimulus Package", contents="WASHINGTON - Politicians debate the latest stimulus package, which opponents argue might help some people who don't deserve it. So it's impossible to say whether it's good or bad."}}); + new[] {new NewsItem{hed="test", contents="MILWAUKEE - This is where the lede would go.", source="Wire"}, + new NewsItem{hed="Politicians Debate Stimulus Package", contents="WASHINGTON - Politicians debate the latest stimulus package, which opponents argue might help some people who don't deserve it. So it's impossible to say whether it's good or bad.", source="Wire"}, + new NewsItem{hed="The Rare Subspecies of Spruce Making a Comeback", contents="Maeve Redding didn't think", source="Arborist"}, + }); } bool quit = false; diff --git a/isometric-park-fna/UI/NewsWindow.cs b/isometric-park-fna/UI/NewsWindow.cs --- a/isometric-park-fna/UI/NewsWindow.cs +++ b/isometric-park-fna/UI/NewsWindow.cs @@ -2,6 +2,7 @@ using ImGuiNET; using Num = System.Numerics; +using System.Linq; namespace isometricparkfna.UI { @@ -9,10 +10,12 @@ public struct NewsItem { public string hed; public string contents; + public string source; } public static class NewsWindow { + public static void Render(ref bool show, ImFontPtr font, Simulation sim, NewsItem[] content) { if (show) @@ -25,6 +28,10 @@ ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 1.0f); ImGui.PushStyleVar(ImGuiStyleVar.TabRounding, 0.0f); ImGui.PushStyleColor(ImGuiCol.WindowBg, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); + ImGui.PushStyleColor(ImGuiCol.Header, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); + ImGui.PushStyleColor(ImGuiCol.HeaderHovered, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); + ImGui.PushStyleColor(ImGuiCol.HeaderActive, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); + ImGui.PushStyleColor(ImGuiCol.ButtonHovered, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); var title_bar = new Num.Vector4(0.65f, 0.65f, 0.65f, 1f); ImGui.PushStyleColor(ImGuiCol.TitleBg, title_bar); @@ -38,16 +45,37 @@ ImGui.PushStyleColor(ImGuiCol.Button, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); ImGui.PushStyleColor(ImGuiCol.Text, new Num.Vector4(0f, 0f, 0f, 1f)); - ImGui.Begin("NEWS", ref show, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings); + ImGui.Begin("NEWS", ref show, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings); + if (ImGui.BeginTabBar("Sources", 0)) { if (ImGui.BeginTabItem("Wire")) { - - foreach (NewsItem story in content) { - if (ImGui.CollapsingHeader(story.hed, ImGuiTreeNodeFlags.DefaultOpen)) { - ImGui.TextWrapped(story.contents); + foreach (NewsItem story in content.Where( s => (s.source == "Wire" ) )) { + if (ImGui.TreeNode(story.hed)) { + ImGui.TextWrapped(story.contents); + ImGui.TreePop(); + } } + ImGui.EndTabItem(); + } + ImGui.EndTabItem(); + if (ImGui.BeginTabItem("Arborist")) { + foreach (NewsItem story in content.Where( s => (s.source == "Arborist" ) )) { + if (ImGui.TreeNode(story.hed)) { + ImGui.TextWrapped(story.contents); + ImGui.TreePop(); + } } + ImGui.EndTabItem(); + } + if (ImGui.BeginTabItem("All True News")) { + foreach (NewsItem story in content.Where( s => (s.source == "Arborist" ) )) { + if (ImGui.TreeNode(story.hed)) { + ImGui.TextWrapped(story.contents); + ImGui.TreePop(); + } + } + ImGui.EndTabItem(); } } @@ -62,7 +90,7 @@ ImGui.End(); ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left; ImGui.PopStyleVar(4); - ImGui.PopStyleColor(8); + ImGui.PopStyleColor(12); ImGui.PopFont(); } }