Show More
Commit Description:
Pull out input from FNAGame.
Commit Description:
Pull out input from FNAGame.
File last commit:
Show/Diff file:
Action:
isometric-park-fna/Renderers/ImGuiWindowRenderer.cs
107 lines | 3.8 KiB | text/x-csharp | CSharpLexer
Add contracts window.
r194 using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
Pull out MainMenu from FNAGame.
r303 using System;
Add contracts window.
r194 using System.Collections.Generic;
Split messages based on types apart from those based on entity.
r270 using System.Linq;
Add contracts window.
r194
using isometricparkfna.UI;
using isometricparkfna.Engines;
using isometricparkfna.Components;
using isometricparkfna.Messages;
using ImGuiNET;
using Encompass;
using SpriteFontPlus;
namespace isometricparkfna.Renderers
{
public class ImGuiWindowRenderer : GeneralRenderer
{
private ImFontPtr font;
Add description and italic font.
r256 private ImFontPtr italicFont;
Add contracts window.
r194 private ImGuiWindowBridgeEngine BridgeEngine;
Add description and italic font.
r256 public ImGuiWindowRenderer(ImFontPtr font, ImFontPtr italicFont, ImGuiWindowBridgeEngine engine)
Add contracts window.
r194 {
this.font = font;
Add description and italic font.
r256 this.italicFont = italicFont;
Add contracts window.
r194 this.BridgeEngine = engine;
}
Various UI improvements.
r291 private (Entity entity, string name, string description, ContractStatus status, decimal amount, string delta_trees, int image_index, Vector2 square)
Add Contract window.
r246 getContractDetails(Entity entity) {
Add description and italic font.
r256 var name = GetComponent<NameAndDescriptionComponent>(entity).DisplayName;
Add Contract window.
r246 var status = GetComponent<ContractStatusComponent>(entity).status;
var amount = GetComponent<BudgetLineComponent>(entity).amount;
var tree_delta = GetComponent<TreeDeltaComponent>(entity).deltaTreesName;
Change image for each contract.
r249 var image_index = GetComponent<ImageComponent>(entity).ImageIndex;
Add description and italic font.
r256 var description = "";
Add company generation.
r254
Various UI improvements.
r291 var square = GetComponent<AreaComponent>(entity).squares[0];
Add company generation.
r254
if (HasComponent<RelatedOrganizationComponent>(entity))
{
var related_organization = GetComponent<RelatedOrganizationComponent>(entity).Entity;
Add description and italic font.
r256 var name_component = GetComponent<NameAndDescriptionComponent>(related_organization);
name = name_component.DisplayName;
description = name_component.Description;
Associate images with companies.
r255 image_index = GetComponent<ImageComponent>(related_organization).ImageIndex;
Add company generation.
r254 }
Various UI improvements.
r291 return (entity, name, description, status, amount, tree_delta, image_index, square);
Add Contract window.
r246
}
Add contracts window.
r194 public override void Render()
{
foreach (ref readonly var entity in ReadEntities<WindowTypeComponent>())
{
var window_type = GetComponent<WindowTypeComponent>(entity).type;
var visible = GetComponent<VisibilityComponent>(entity).visible;
if (visible)
{
switch (window_type)
{
case Window.Contracts:
var contracts = ReadEntities<AreaComponent>();
Various UI improvements.
r291 var contract_data = new List<(Entity, string, string, ContractStatus, decimal, string, int, Vector2)>();
Add contracts window.
r194
foreach(var e in contracts)
{
Add Contract window.
r246 contract_data.Add(getContractDetails(e));
Add contracts window.
r194 }
Add status to Contracts window.
r195 ContractsWindow.Render(this.font, this.BridgeEngine, contract_data);
Add contracts window.
r194 break;
Add Contract window.
r246 case Window.Contract:
var data = getContractDetails(entity);
Split messages based on types apart from those based on entity.
r270 // var area_size = GetComponent<AreaComponent>(entity).squares.Length;
var area = GetComponent<AreaComponent>(entity).squares;
var area_size = GetComponent<AreaComponent>(entity).squares.Length;
Add Contract window.
r246
Various UI improvements.
r291 ContractWindow.Render(this.font, this.italicFont, this.BridgeEngine, entity, data.name, data.description, data.status, data.amount, data.delta_trees, area_size, data.image_index, data.square);
Add Contract window.
r246
break;
Pull out MainMenu from FNAGame.
r303 case Window.MainMenu:
MainMenu.Render(this.font, this.BridgeEngine);
Add Contract window.
r246
Pull out MainMenu from FNAGame.
r303 break;
Add contracts window.
r194 default:
break;
}
}
}
}
}
Split messages based on types apart from those based on entity.
r270 }