Overhaul UI and overall QoL
This commit is contained in:
@@ -57,6 +57,13 @@ namespace KernelPanic.UI
|
||||
_asciiPlaceholder = DistroArtPresenter.CreatePlaceholder();
|
||||
_asciiPlaceholder.AddToClassList("hidden");
|
||||
_populatedState.Insert(0, _asciiPlaceholder);
|
||||
_panel.focusable = true;
|
||||
_panel.RegisterCallback<KeyDownEvent>(evt =>
|
||||
{
|
||||
if (evt.keyCode != KeyCode.Return) return;
|
||||
ActivateCurrentUnit();
|
||||
evt.StopPropagation();
|
||||
});
|
||||
_panel?.RegisterCallback<ClickEvent>(_ => ActivateCurrentUnit());
|
||||
}
|
||||
|
||||
@@ -133,11 +140,14 @@ namespace KernelPanic.UI
|
||||
_populatedState.RemoveFromClassList("hidden");
|
||||
_emptyState.AddToClassList("hidden");
|
||||
_currentUnit = unit;
|
||||
TerminalTheme.SetDistro(_panel, unit);
|
||||
_panel.tooltip = "[F2] next distro / [Enter] inspect";
|
||||
|
||||
_titleLabel.text = "[ neofetch ]";
|
||||
_asciiFitter.SetArt(DistroArtPresenter.Render(_asciiLabel, _asciiPlaceholder, unit));
|
||||
_unitNameLabel.text = DistroPresentation.DisplayName(unit);
|
||||
_languagesLabel.text = DistroPresentation.FormatLanguages(unit);
|
||||
_passiveLabel.tooltip = unit.Passive == null ? "" : unit.Passive.RulesText;
|
||||
_passiveLabel.text = unit.Passive == null || string.IsNullOrWhiteSpace(unit.Passive.Name) ? "--" : unit.Passive.Name;
|
||||
int bestWave = Math.Max(0, _getBestWave?.Invoke(unit) ?? 0);
|
||||
_bestWaveLabel.text = bestWave > 0 ? bestWave.ToString() : "--";
|
||||
@@ -157,9 +167,9 @@ namespace KernelPanic.UI
|
||||
string color = $"#{htmlColor}";
|
||||
Color parsedColor = ColorUtility.TryParseHtmlString(color, out Color parsed) ? parsed : Color.green;
|
||||
_panel.style.borderTopColor = new StyleColor(parsedColor);
|
||||
_panel.style.borderRightColor = new StyleColor(parsedColor);
|
||||
_panel.style.borderBottomColor = new StyleColor(parsedColor);
|
||||
_panel.style.borderLeftColor = new StyleColor(parsedColor);
|
||||
|
||||
|
||||
|
||||
_titleLabel.style.color = new StyleColor(parsedColor);
|
||||
_unitNameLabel.style.color = new StyleColor(parsedColor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user