Description:
Add News Items from file.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -0,0 +1,5 | |||||
|
|
1 | - hed: deserialized | ||
|
|
2 | contents: 'This is a #test#.' | ||
|
|
3 | source: Wire | ||
|
|
4 | variables: | ||
|
|
5 | test: albatross |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,14 +1,15 | |||||
|
1 | { |
|
1 | { |
|
2 | "format": 1, |
|
2 | "format": 1, |
|
3 | "restore": { |
|
3 | "restore": { |
|
4 |
"/ |
|
4 | "/Users/alys/repos/isometric-park-fna/SpriteFontPlus/src/SpriteFontPlus.FNA.csproj": {} |
|
5 | }, |
|
5 | }, |
|
6 | "projects": { |
|
6 | "projects": { |
|
7 |
"/ |
|
7 | "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj": { |
|
|
8 | "version": "1.0.0", | ||
|
8 | "restore": { |
|
9 | "restore": { |
|
9 |
"projectUniqueName": "/ |
|
10 | "projectUniqueName": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj", |
|
10 | "projectName": "FNA", |
|
11 | "projectName": "FNA", |
|
11 |
"projectPath": "/ |
|
12 | "projectPath": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj", |
|
12 | "frameworks": { |
|
13 | "frameworks": { |
|
13 | "net48": { |
|
14 | "net48": { |
|
14 | "projectReferences": {} |
|
15 | "projectReferences": {} |
@@ -19,20 +20,17 | |||||
|
19 | "net48": {} |
|
20 | "net48": {} |
|
20 | } |
|
21 | } |
|
21 | }, |
|
22 | }, |
|
22 |
"/ |
|
23 | "/Users/alys/repos/isometric-park-fna/SpriteFontPlus/src/SpriteFontPlus.FNA.csproj": { |
|
23 | "version": "1.0.0", |
|
24 | "version": "1.0.0", |
|
24 | "restore": { |
|
25 | "restore": { |
|
25 |
"projectUniqueName": "/ |
|
26 | "projectUniqueName": "/Users/alys/repos/isometric-park-fna/SpriteFontPlus/src/SpriteFontPlus.FNA.csproj", |
|
26 | "projectName": "SpriteFontPlus", |
|
27 | "projectName": "SpriteFontPlus", |
|
27 |
"projectPath": "/ |
|
28 | "projectPath": "/Users/alys/repos/isometric-park-fna/SpriteFontPlus/src/SpriteFontPlus.FNA.csproj", |
|
28 |
"packagesPath": "/ |
|
29 | "packagesPath": "/Users/alys/.nuget/packages/", |
|
29 |
"outputPath": "/ |
|
30 | "outputPath": "/Users/alys/repos/isometric-park-fna/SpriteFontPlus/src/obj/", |
|
30 | "projectStyle": "PackageReference", |
|
31 | "projectStyle": "PackageReference", |
|
31 | "fallbackFolders": [ |
|
||
|
32 | "/usr/share/dotnet/sdk/NuGetFallbackFolder" |
|
||
|
33 | ], |
|
||
|
34 | "configFilePaths": [ |
|
32 | "configFilePaths": [ |
|
35 |
"/ |
|
33 | "/Users/alys/.config/NuGet/NuGet.Config" |
|
36 | ], |
|
34 | ], |
|
37 | "originalTargetFrameworks": [ |
|
35 | "originalTargetFrameworks": [ |
|
38 | "net45" |
|
36 | "net45" |
@@ -43,8 +41,8 | |||||
|
43 | "frameworks": { |
|
41 | "frameworks": { |
|
44 | "net45": { |
|
42 | "net45": { |
|
45 | "projectReferences": { |
|
43 | "projectReferences": { |
|
46 |
"/ |
|
44 | "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj": { |
|
47 |
"projectPath": "/ |
|
45 | "projectPath": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj" |
|
48 | } |
|
46 | } |
|
49 | } |
|
47 | } |
|
50 | } |
|
48 | } |
@@ -4,10 +4,10 | |||||
|
4 | <RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess> |
|
4 | <RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess> |
|
5 | <RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool> |
|
5 | <RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool> |
|
6 | <ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile> |
|
6 | <ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile> |
|
7 |
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/ |
|
7 | <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/alys/.nuget/packages/</NuGetPackageRoot> |
|
8 |
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/ |
|
8 | <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/alys/.nuget/packages/</NuGetPackageFolders> |
|
9 | <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle> |
|
9 | <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle> |
|
10 |
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5. |
|
10 | <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.1.0</NuGetToolVersion> |
|
11 | </PropertyGroup> |
|
11 | </PropertyGroup> |
|
12 | <PropertyGroup> |
|
12 | <PropertyGroup> |
|
13 | <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> |
|
13 | <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> |
@@ -26,23 +26,19 | |||||
|
26 | ] |
|
26 | ] |
|
27 | }, |
|
27 | }, |
|
28 | "packageFolders": { |
|
28 | "packageFolders": { |
|
29 |
"/ |
|
29 | "/Users/alys/.nuget/packages/": {} |
|
30 | "/usr/share/dotnet/sdk/NuGetFallbackFolder": {} |
|
||
|
31 | }, |
|
30 | }, |
|
32 | "project": { |
|
31 | "project": { |
|
33 | "version": "1.0.0", |
|
32 | "version": "1.0.0", |
|
34 | "restore": { |
|
33 | "restore": { |
|
35 |
"projectUniqueName": "/ |
|
34 | "projectUniqueName": "/Users/alys/repos/isometric-park-fna/SpriteFontPlus/src/SpriteFontPlus.FNA.csproj", |
|
36 | "projectName": "SpriteFontPlus", |
|
35 | "projectName": "SpriteFontPlus", |
|
37 |
"projectPath": "/ |
|
36 | "projectPath": "/Users/alys/repos/isometric-park-fna/SpriteFontPlus/src/SpriteFontPlus.FNA.csproj", |
|
38 |
"packagesPath": "/ |
|
37 | "packagesPath": "/Users/alys/.nuget/packages/", |
|
39 |
"outputPath": "/ |
|
38 | "outputPath": "/Users/alys/repos/isometric-park-fna/SpriteFontPlus/src/obj/", |
|
40 | "projectStyle": "PackageReference", |
|
39 | "projectStyle": "PackageReference", |
|
41 | "fallbackFolders": [ |
|
||
|
42 | "/usr/share/dotnet/sdk/NuGetFallbackFolder" |
|
||
|
43 | ], |
|
||
|
44 | "configFilePaths": [ |
|
40 | "configFilePaths": [ |
|
45 |
"/ |
|
41 | "/Users/alys/.config/NuGet/NuGet.Config" |
|
46 | ], |
|
42 | ], |
|
47 | "originalTargetFrameworks": [ |
|
43 | "originalTargetFrameworks": [ |
|
48 | "net45" |
|
44 | "net45" |
@@ -53,8 +49,8 | |||||
|
53 | "frameworks": { |
|
49 | "frameworks": { |
|
54 | "net45": { |
|
50 | "net45": { |
|
55 | "projectReferences": { |
|
51 | "projectReferences": { |
|
56 |
"/ |
|
52 | "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj": { |
|
57 |
"projectPath": "/ |
|
53 | "projectPath": "/Users/alys/repos/isometric-park-fna/FNA/FNA.csproj" |
|
58 | } |
|
54 | } |
|
59 | } |
|
55 | } |
|
60 | } |
|
56 | } |
@@ -31,6 +31,8 | |||||
|
31 | "city": ["Milwaukee", "Chicago", "Washington", "Minneapolis", "Dallas", |
|
31 | "city": ["Milwaukee", "Chicago", "Washington", "Minneapolis", "Dallas", |
|
32 | "Oklahoma City", "Boston", "Los Angeles", "Portland", "Santa Fe", |
|
32 | "Oklahoma City", "Boston", "Los Angeles", "Portland", "Santa Fe", |
|
33 | "New York City"], |
|
33 | "New York City"], |
|
34 | "vars": "assistantName = #assistantName# \n whatever = #whatever#" |
|
34 | "vars": "assistantName = #assistantName# \n whatever = #whatever#", |
|
|
35 | "test": "test", | ||
|
|
36 | "empty": "" | ||
|
35 |
|
37 | ||
|
36 | } |
|
38 | } |
@@ -203,16 +203,17 | |||||
|
203 |
|
203 | ||
|
204 | grammar.AddModifier("toUpper", toUpper); |
|
204 | grammar.AddModifier("toUpper", toUpper); |
|
205 |
|
205 | ||
|
206 |
var newItems = new[] {new NewsItem{hed=" |
|
206 | var newItems = new[] {new NewsItem{hed="Test", contents="#city.toUpper# - This is where the lede would go. #whatever#", source="Wire"}, |
|
207 | new NewsItem{hed="Politicians Debate Stimulus Package", contents="WASHINGTON - Poliicians 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"}, |
|
207 | new NewsItem{hed="Politicians Debate Stimulus Package", contents="WASHINGTON - Poliicians 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"}, |
|
208 | new NewsItem{hed="The Rare Subspecies of Spruce Making a Comeback", contents="Maeve Redding didn't think", source="Arborist"}, |
|
208 | new NewsItem{hed="The Rare Subspecies of Spruce Making a Comeback", contents="Maeve Redding didn't think the test would ever be seen in Red Harbor again.", source="Arborist"}, |
|
209 | }; |
|
209 | }; |
|
210 |
|
210 | ||
|
211 | this.newsItems = newItems.ToList(); |
|
211 | this.newsItems = newItems.ToList(); |
|
212 | this.newsItems.AddRange(NewsItem.FromYaml(@" |
|
212 | |
|
213 | - hed: deserialized |
|
213 | using (var sr = new StreamReader(@"Content/news_items.yaml")) |
|
214 | contents: abc |
|
214 | { |
|
215 | source: Wire")); |
|
215 | this.newsItems.AddRange(NewsItem.FromYaml(sr.ReadToEnd())); |
|
|
216 | } | ||
|
216 | this.newsItems = this.newsItems.Select(s => s.Flatten(this.grammar)).ToList(); |
|
217 | this.newsItems = this.newsItems.Select(s => s.Flatten(this.grammar)).ToList(); |
|
217 |
|
218 | ||
|
218 | this.remainingDialog = new Queue<Node<DialogOption>>(); |
|
219 | this.remainingDialog = new Queue<Node<DialogOption>>(); |
@@ -2,6 +2,7 | |||||
|
2 | using ImGuiNET; |
|
2 | using ImGuiNET; |
|
3 |
|
3 | ||
|
4 | using Num = System.Numerics; |
|
4 | using Num = System.Numerics; |
|
|
5 | using System; | ||
|
5 | using System.Linq; |
|
6 | using System.Linq; |
|
6 | using System.IO; |
|
7 | using System.IO; |
|
7 | using System.Collections.Generic; |
|
8 | using System.Collections.Generic; |
@@ -14,11 +15,28 | |||||
|
14 | public string hed; |
|
15 | public string hed; |
|
15 | public string contents; |
|
16 | public string contents; |
|
16 | public string source; |
|
17 | public string source; |
|
|
18 | public Dictionary<string, string> variables; | ||
|
17 |
|
19 | ||
|
18 | public NewsItem Flatten(TraceryNet.Grammar grammar) { |
|
20 | public NewsItem Flatten(TraceryNet.Grammar grammar) { |
|
|
21 | |||
|
|
22 | var variableString = "#"; | ||
|
|
23 | |||
|
|
24 | if (this.variables != null) { | ||
|
|
25 | foreach (var variable in this.variables) { | ||
|
|
26 | variableString += String.Format("[{0}:{1}]", variable.Key, variable.Value); | ||
|
|
27 | } | ||
|
|
28 | } | ||
|
|
29 | |||
|
|
30 | variableString += "vars# "; | ||
|
|
31 | |||
|
|
32 | var result = grammar.Flatten(variableString); | ||
|
|
33 | #if DEBUG | ||
|
|
34 | System.Console.Write(variableString); | ||
|
|
35 | #endif | ||
|
|
36 | |||
|
19 | return new NewsItem { |
|
37 | return new NewsItem { |
|
20 | hed = grammar.Flatten(this.hed), |
|
38 | hed = grammar.Flatten(this.hed), |
|
21 |
contents = grammar.Flatten( |
|
39 | contents = grammar.Flatten(contents), |
|
22 | source = grammar.Flatten(this.source) |
|
40 | source = grammar.Flatten(this.source) |
|
23 | }; |
|
41 | }; |
|
24 | } |
|
42 | } |
@@ -94,7 +112,7 | |||||
|
94 | ImGui.EndTabItem(); |
|
112 | ImGui.EndTabItem(); |
|
95 | } |
|
113 | } |
|
96 | if (ImGui.BeginTabItem("All True News")) { |
|
114 | if (ImGui.BeginTabItem("All True News")) { |
|
97 |
foreach (NewsItem story in content.Where( s => (s.source == " |
|
115 | foreach (NewsItem story in content.Where( s => (s.source == "True" ) )) { |
|
98 | if (ImGui.TreeNode(story.hed)) { |
|
116 | if (ImGui.TreeNode(story.hed)) { |
|
99 | ImGui.TextWrapped(story.contents); |
|
117 | ImGui.TextWrapped(story.contents); |
|
100 | ImGui.TreePop(); |
|
118 | ImGui.TreePop(); |
@@ -117,6 +117,9 | |||||
|
117 | <None Include="Content\grammar.json"> |
|
117 | <None Include="Content\grammar.json"> |
|
118 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
|
118 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
|
119 | </None> |
|
119 | </None> |
|
|
120 | <None Include="Content\news_items.yaml"> | ||
|
|
121 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
|
|
122 | </None> | ||
|
120 | </ItemGroup> |
|
123 | </ItemGroup> |
|
121 | <ItemGroup> |
|
124 | <ItemGroup> |
|
122 | <Reference Include="System" /> |
|
125 | <Reference Include="System" /> |
You need to be logged in to leave comments.
Login now