Description:
Add multiple sources.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -882,8 +882,10 | |||
|
882 | 882 | if (this.showNews) |
|
883 | 883 | { |
|
884 | 884 | NewsWindow.Render(ref this.showNews, debugWindow.monoFont, this.simulation, |
|
885 | new[] {new NewsItem{hed="test", contents="MILWAUKEE - This is where the lede would go."}, | |
|
886 |
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."} |
|
|
885 | new[] {new NewsItem{hed="test", contents="MILWAUKEE - This is where the lede would go.", source="Wire"}, | |
|
886 | 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"}, | |
|
887 | new NewsItem{hed="The Rare Subspecies of Spruce Making a Comeback", contents="Maeve Redding didn't think", source="Arborist"}, | |
|
888 | }); | |
|
887 | 889 | } |
|
888 | 890 | |
|
889 | 891 | bool quit = false; |
@@ -2,6 +2,7 | |||
|
2 | 2 | using ImGuiNET; |
|
3 | 3 | |
|
4 | 4 | using Num = System.Numerics; |
|
5 | using System.Linq; | |
|
5 | 6 | |
|
6 | 7 | namespace isometricparkfna.UI |
|
7 | 8 | { |
@@ -9,10 +10,12 | |||
|
9 | 10 | public struct NewsItem { |
|
10 | 11 | public string hed; |
|
11 | 12 | public string contents; |
|
13 | public string source; | |
|
12 | 14 | } |
|
13 | 15 | |
|
14 | 16 | public static class NewsWindow |
|
15 | 17 | { |
|
18 | ||
|
16 | 19 | public static void Render(ref bool show, ImFontPtr font, Simulation sim, NewsItem[] content) |
|
17 | 20 | { |
|
18 | 21 | if (show) |
@@ -25,6 +28,10 | |||
|
25 | 28 | ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 1.0f); |
|
26 | 29 | ImGui.PushStyleVar(ImGuiStyleVar.TabRounding, 0.0f); |
|
27 | 30 | ImGui.PushStyleColor(ImGuiCol.WindowBg, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); |
|
31 | ImGui.PushStyleColor(ImGuiCol.Header, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); | |
|
32 | ImGui.PushStyleColor(ImGuiCol.HeaderHovered, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); | |
|
33 | ImGui.PushStyleColor(ImGuiCol.HeaderActive, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); | |
|
34 | ImGui.PushStyleColor(ImGuiCol.ButtonHovered, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); | |
|
28 | 35 | |
|
29 | 36 | var title_bar = new Num.Vector4(0.65f, 0.65f, 0.65f, 1f); |
|
30 | 37 | ImGui.PushStyleColor(ImGuiCol.TitleBg, title_bar); |
@@ -38,16 +45,37 | |||
|
38 | 45 | |
|
39 | 46 | ImGui.PushStyleColor(ImGuiCol.Button, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); |
|
40 | 47 | ImGui.PushStyleColor(ImGuiCol.Text, new Num.Vector4(0f, 0f, 0f, 1f)); |
|
41 |
ImGui.Begin("NEWS", ref show, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags. |
|
|
48 | ImGui.Begin("NEWS", ref show, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings); | |
|
49 | ||
|
42 | 50 | |
|
43 | 51 | if (ImGui.BeginTabBar("Sources", 0)) { |
|
44 | 52 | if (ImGui.BeginTabItem("Wire")) { |
|
45 | ||
|
46 | foreach (NewsItem story in content) { | |
|
47 | if (ImGui.CollapsingHeader(story.hed, ImGuiTreeNodeFlags.DefaultOpen)) { | |
|
48 | ImGui.TextWrapped(story.contents); | |
|
53 | foreach (NewsItem story in content.Where( s => (s.source == "Wire" ) )) { | |
|
54 | if (ImGui.TreeNode(story.hed)) { | |
|
55 | ImGui.TextWrapped(story.contents); | |
|
56 | ImGui.TreePop(); | |
|
57 | } | |
|
49 | 58 | } |
|
59 | ImGui.EndTabItem(); | |
|
60 | } | |
|
61 | ImGui.EndTabItem(); | |
|
62 | if (ImGui.BeginTabItem("Arborist")) { | |
|
63 | foreach (NewsItem story in content.Where( s => (s.source == "Arborist" ) )) { | |
|
64 | if (ImGui.TreeNode(story.hed)) { | |
|
65 | ImGui.TextWrapped(story.contents); | |
|
66 | ImGui.TreePop(); | |
|
67 | } | |
|
50 | 68 | } |
|
69 | ImGui.EndTabItem(); | |
|
70 | } | |
|
71 | if (ImGui.BeginTabItem("All True News")) { | |
|
72 | foreach (NewsItem story in content.Where( s => (s.source == "Arborist" ) )) { | |
|
73 | if (ImGui.TreeNode(story.hed)) { | |
|
74 | ImGui.TextWrapped(story.contents); | |
|
75 | ImGui.TreePop(); | |
|
76 | } | |
|
77 | } | |
|
78 | ImGui.EndTabItem(); | |
|
51 | 79 | } |
|
52 | 80 | } |
|
53 | 81 | |
@@ -62,7 +90,7 | |||
|
62 | 90 | ImGui.End(); |
|
63 | 91 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left; |
|
64 | 92 | ImGui.PopStyleVar(4); |
|
65 |
ImGui.PopStyleColor( |
|
|
93 | ImGui.PopStyleColor(12); | |
|
66 | 94 | ImGui.PopFont(); |
|
67 | 95 | } |
|
68 | 96 | } |
You need to be logged in to leave comments.
Login now