|
|
using Microsoft.Xna.Framework;
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
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;
|
|
|
private ImGuiWindowBridgeEngine BridgeEngine;
|
|
|
public ImGuiWindowRenderer(ImFontPtr font, ImGuiWindowBridgeEngine engine)
|
|
|
{
|
|
|
this.font = font;
|
|
|
this.BridgeEngine = engine;
|
|
|
}
|
|
|
|
|
|
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>();
|
|
|
|
|
|
var contract_data = new List<(Entity, string, ContractStatus, decimal)>();
|
|
|
|
|
|
// var names = contracts.Select(entity => GetComponent<NameComponent>(entity).DisplayName)
|
|
|
foreach(var e in contracts)
|
|
|
{
|
|
|
var name = GetComponent<NameComponent>(e).DisplayName;
|
|
|
var status = GetComponent<ContractStatusComponent>(e).status;
|
|
|
var amount = GetComponent<BudgetLineComponent>(e).amount;
|
|
|
contract_data.Add((e, name, status, amount));
|
|
|
|
|
|
}
|
|
|
|
|
|
ContractsWindow.Render(this.font, this.BridgeEngine, contract_data);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|