first full rendering sample of pop% cap with styling

This commit is contained in:
2025-03-16 12:45:09 +01:00
parent 2c9ff99502
commit 7bb34a4b51
6 changed files with 112 additions and 42 deletions

View File

@ -1,19 +0,0 @@
using ReactiveUI.SourceGenerators;
using Avalonia.Media;
namespace StarsAssistant.ViewModels.DataGridColumn;
public partial class PopulationCapacity(int value) : ViewModelBase
{
[Reactive] private int _value = value;
public IBrush BackgroundColor => _value switch
{
< 25 => Brushes.Khaki,
<= 33 => Brushes.PaleGreen,
<= 50 => Brushes.Khaki,
> 100 => Brushes.LightCoral,
> 99 => Brushes.LightGray,
_ => Brushes.White
};
}

View File

@ -189,8 +189,7 @@ public partial class PlayerPlanetViewModel : ViewModelBase
public int MaxTerraforming => Planet.MaxTerraforming ?? 0;
// public int CapacityPercent => Planet.CapacityPercent ?? 0;
public DataGridColumn.PopulationCapacity CapacityPercent => new(Planet.CapacityPercent ?? 0);
public int CapacityPercent => Planet.CapacityPercent ?? 0;
public int ScanRange => Planet.ScanRange ?? 0;