This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
Lemonade/Lemonade/ResultScreen.cs

48 lines
1.5 KiB
C#
Raw Normal View History

2020-06-12 20:02:39 +02:00
using System;
using System.Collections.Generic;
using System.Drawing;
using CC_Functions.Commandline;
using CC_Functions.Commandline.TUI;
namespace Lemonade
2020-06-12 20:02:04 +02:00
{
2020-06-12 20:02:39 +02:00
public class ResultScreen : CenteredScreen
{
public delegate void OkDelegate();
2020-06-12 20:16:11 +02:00
private readonly Label lab;
2020-06-12 20:02:39 +02:00
public ResultScreen(Settings settings) : base(200, 20, ConsoleColor.Black, settings.Color)
{
ContentPanel.ForeColor = ConsoleColor.DarkGray;
Title = "Lemonade - Daily financial report";
lab = new Label("");
ContentPanel.Controls.Add(lab);
Input += (screen, args) => Ok?.Invoke();
Close += (screen, args) => Ok?.Invoke();
}
2020-06-12 20:16:11 +02:00
public event OkDelegate Ok;
2020-06-12 20:02:39 +02:00
public void Setup(IEnumerable<PlayerState> players)
{
2020-06-12 20:16:11 +02:00
lab.Content = players.ToStringTable(
new[]
{
"Player", "Glasses made", "Earnings per glass", "Glasses sold", "Signs made", "Income", "Expenses",
"Profit", "Budget"
},
s => s.Number,
s => s.Glasses,
s => s.GlassPrice,
s => s.Sales,
s => s.Signs,
s => s.Earnings,
s => s.Expenses,
s => s.Earnings - s.Expenses,
s => s.Budget);
2020-06-12 20:02:39 +02:00
lab.Render();
ActualSize = new Size(lab.Size.Width, lab.Size.Height);
}
}
2020-06-12 20:02:04 +02:00
}