Description:
Add description and italic font.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r256:9215a6f099ee -

1 NO CONTENT: new file 100755, binary diff hidden
@@ -1,10 +1,13
1 1
2 2 using Encompass;
3 3
4 #nullable enable
5
4 6 namespace isometricparkfna.Components
5 7 {
6 public struct NameComponent : IComponent
8 public struct NameAndDescriptionComponent : IComponent
7 9 {
8 10 public string DisplayName;
11 public string? Description;
9 12 }
10 13 } No newline at end of file
@@ -124,7 +124,7
124 124
125 125 // AddComponent
126 126 AddComponent(contract, new AreaComponent { squares = squares });
127 AddComponent(contract, new NameComponent { DisplayName = this.grammar.Flatten(message.name) });
127 AddComponent(contract, new NameAndDescriptionComponent { DisplayName = this.grammar.Flatten(message.name) });
128 128 AddComponent(contract, new SelectedComponent { selected = false });
129 129 AddComponent(contract, new ContractStatusComponent { status = ContractStatus.Proposed, date = this.simulation.DateTime });
130 130 AddComponent(contract, new TreeDeltaComponent { deltaTrees = deltaTrees });
@@ -222,7 +222,7
222 222 WorldBuilder.AddEngine(new OrganizationSpawner(this.simulation, this.grammar));
223 223
224 224 WorldBuilder.AddGeneralRenderer(new AreaRenderer(this.batch, this.monoFont), 1);
225 WorldBuilder.AddGeneralRenderer(new ImGuiWindowRenderer(debugWindow.monoFont, this.imGuiWindowBridgeEngine), 2);
225 WorldBuilder.AddGeneralRenderer(new ImGuiWindowRenderer(debugWindow.monoFont, debugWindow.italicFont, this.imGuiWindowBridgeEngine), 2);
226 226 var contractWindow = WorldBuilder.CreateEntity();
227 227 WorldBuilder.SetComponent(contractWindow, new VisibilityComponent { visible = false });
228 228 WorldBuilder.SetComponent(contractWindow, new WindowTypeComponent { type = isometricparkfna.Messages.Window.Contracts });
@@ -258,7 +258,8
258 258 for (int i = 0; i < 10; i++)
259 259 {
260 260
261 WorldBuilder.SendMessage(new SpawnOrganizationtMessage { offersContracts = true });
261 WorldBuilder.SendMessage(new SpawnOrganizationtMessage { offersContracts = true,
262 description = "Expert loggers since 1893." });
262 263 }
263 264 WorldBuilder.SendMessage(new SpawnContractMessage
264 265 {
@@ -18,32 +18,37
18 18 public class ImGuiWindowRenderer : GeneralRenderer
19 19 {
20 20 private ImFontPtr font;
21 private ImFontPtr italicFont;
21 22 private ImGuiWindowBridgeEngine BridgeEngine;
22 public ImGuiWindowRenderer(ImFontPtr font, ImGuiWindowBridgeEngine engine)
23 public ImGuiWindowRenderer(ImFontPtr font, ImFontPtr italicFont, ImGuiWindowBridgeEngine engine)
23 24 {
24 25 this.font = font;
26 this.italicFont = italicFont;
25 27 this.BridgeEngine = engine;
26 28 }
27 29
28 private (Entity entity, string name, ContractStatus status, decimal amount, string delta_trees, int image_index)
30 private (Entity entity, string name, string description, ContractStatus status, decimal amount, string delta_trees, int image_index)
29 31 getContractDetails(Entity entity) {
30 32
31 var name = GetComponent<NameComponent>(entity).DisplayName;
33 var name = GetComponent<NameAndDescriptionComponent>(entity).DisplayName;
32 34 var status = GetComponent<ContractStatusComponent>(entity).status;
33 35 var amount = GetComponent<BudgetLineComponent>(entity).amount;
34 36 var tree_delta = GetComponent<TreeDeltaComponent>(entity).deltaTreesName;
35 37 var image_index = GetComponent<ImageComponent>(entity).ImageIndex;
38 var description = "";
36 39
37 40
38 41 if (HasComponent<RelatedOrganizationComponent>(entity))
39 42 {
40 43 var related_organization = GetComponent<RelatedOrganizationComponent>(entity).Entity;
41 44
42 name = GetComponent<NameComponent>(related_organization).DisplayName;
45 var name_component = GetComponent<NameAndDescriptionComponent>(related_organization);
46 name = name_component.DisplayName;
47 description = name_component.Description;
43 48 image_index = GetComponent<ImageComponent>(related_organization).ImageIndex;
44 49 }
45 50
46 return (entity, name, status, amount, tree_delta, image_index);
51 return (entity, name, description, status, amount, tree_delta, image_index);
47 52
48 53 }
49 54
@@ -61,7 +66,7
61 66 case Window.Contracts:
62 67 var contracts = ReadEntities<AreaComponent>();
63 68
64 var contract_data = new List<(Entity, string, ContractStatus, decimal, string, int)>();
69 var contract_data = new List<(Entity, string, string, ContractStatus, decimal, string, int)>();
65 70
66 71 foreach(var e in contracts)
67 72 {
@@ -74,7 +79,7
74 79
75 80 var data = getContractDetails(entity);
76 81
77 ContractWindow.Render(this.font, this.BridgeEngine, entity, data.name, data.status, data.amount, data.delta_trees, data.image_index);
82 ContractWindow.Render(this.font, this.italicFont, this.BridgeEngine, entity, data.name, data.description, data.status, data.amount, data.delta_trees, data.image_index);
78 83
79 84 //Logging.Trace(string.Format("Rendering Contract Window for {0}", data.name));
80 85
@@ -31,7 +31,7
31 31 }
32 32
33 33
34 public static void Render(ImFontPtr font, ImGuiWindowBridgeEngine engine, Entity entity, string name, ContractStatus status, decimal amount, string delta_trees, int imageIndex)
34 public static void Render(ImFontPtr font, ImFontPtr italicFont, ImGuiWindowBridgeEngine engine, Entity entity, string name, string description, ContractStatus status, decimal amount, string delta_trees, int imageIndex)
35 35
36 36 {
37 37 bool newShow = true;
@@ -51,6 +51,10
51 51
52 52 ImGui.Image(_imGuiTexture, new Num.Vector2(250, 200), map.GetSourceUVStart(imageIndex), map.GetSourceUVEnd(imageIndex), Num.Vector4.One, Num.Vector4.Zero); // Here, the previously loaded texture is used
53 53
54 ImGui.PushFont(italicFont);
55 ImGui.Text(description);
56 ImGui.PopFont();
57
54 58 ImGui.Separator();
55 59 switch (status)
56 60 {
@@ -18,11 +18,11
18 18 {
19 19 public static bool show_all;
20 20
21 private static (Entity entity, string name, ContractStatus status, decimal amount, string delta_trees, int image_index) selected;
21 private static (Entity entity, string name, string description, ContractStatus status, decimal amount, string delta_trees, int image_index) selected;
22 22
23 23
24 24 public static void Render(ImFontPtr font, ImGuiWindowBridgeEngine engine,
25 List<(Entity entity, string name, ContractStatus status, decimal amount, string delta_trees, int image_index)> contracts)
25 List<(Entity entity, string name, string description, ContractStatus status, decimal amount, string delta_trees, int image_index)> contracts)
26 26 {
27 27 bool newShow = true;
28 28
@@ -32,6 +32,7
32 32 private bool show_test_window;
33 33
34 34 public ImFontPtr monoFont;
35 public ImFontPtr italicFont;
35 36
36 37 public ImageMap map;
37 38
@@ -51,6 +52,7
51 52 #endif
52 53
53 54 this.monoFont = io.Fonts.AddFontFromFileTTF(@"Content/iosevka-term-extendedmedium.ttf", 15);
55 this.italicFont = io.Fonts.AddFontFromFileTTF(@"Content/iosevka-term-extendedmediumitalic.ttf", 15);
54 56 unsafe //god this sucks
55 57 {
56 58 ImFontConfigPtr config = ImGuiNative.ImFontConfig_ImFontConfig();
@@ -129,6 +129,9
129 129 <None Include="Content\iosevka-term-extendedmedium.ttf">
130 130 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
131 131 </None>
132 <None Include="Content\iosevka-term-extendedmediumitalic.ttf">
133 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
134 </None>
132 135 <None Include="Content\iosevka-term-medium.ttf">
133 136 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
134 137 </None>
You need to be logged in to leave comments. Login now