Add NixOS and Go
This commit is contained in:
@@ -11,6 +11,7 @@ namespace KernelPanic.UI
|
||||
{
|
||||
ResolutionTrack.InterpreterQueue => "QUEUE / FIFO",
|
||||
ResolutionTrack.LazyStack => "STACK / LIFO",
|
||||
ResolutionTrack.Goroutine => "GOROUTINE / NEXT ROUND",
|
||||
_ => "NATIVE / NOW"
|
||||
};
|
||||
|
||||
@@ -34,17 +35,62 @@ namespace KernelPanic.UI
|
||||
header.Add(Text($"{cost}c", "software-cost"));
|
||||
target.Add(header);
|
||||
target.Add(Text(string.IsNullOrWhiteSpace(definition.DisplayName) ? definition.name : definition.DisplayName, "software-name"));
|
||||
target.Add(Text(TrackName(definition.ResolutionTrack), "software-track"));
|
||||
bool python = definition.Language == Language.Python;
|
||||
string role = null;
|
||||
string displayRules = rules;
|
||||
if (python)
|
||||
{
|
||||
// Lift only known presentation prefixes out of the generated rules.
|
||||
// Amounts, upgrades, targets and conditions remain authoritative.
|
||||
foreach (string prefix in new[] { "payload", "automation", "modifier", "preparation" })
|
||||
{
|
||||
if (!rules.StartsWith(prefix + ": ", System.StringComparison.Ordinal)) continue;
|
||||
role = prefix;
|
||||
displayRules = rules.Substring(prefix.Length + 2);
|
||||
target.AddToClassList("software-python-" + role);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (role != null)
|
||||
{
|
||||
var metadata = new VisualElement();
|
||||
metadata.AddToClassList("software-python-metadata");
|
||||
metadata.Add(Text(role.ToUpperInvariant(), "software-python-role"));
|
||||
metadata.Add(Text(TrackName(definition.ResolutionTrack), "software-track"));
|
||||
target.Add(metadata);
|
||||
}
|
||||
else target.Add(Text(TrackName(definition.ResolutionTrack), "software-track"));
|
||||
|
||||
if (card.DrawRider > 0) rules += $" Draw {card.DrawRider}.";
|
||||
if (card.DrawRider > 0)
|
||||
{
|
||||
rules += $" Draw {card.DrawRider}.";
|
||||
displayRules += $" Draw {card.DrawRider}.";
|
||||
}
|
||||
target.tooltip = rules;
|
||||
if (card.IsBroken) target.tooltip += "\n\n" + CardPreviewService.CorruptionDetails(card);
|
||||
var body = new VisualElement();
|
||||
body.AddToClassList("software-body");
|
||||
// Break at a sentence boundary only. Never reinterpret effect amounts or conditions.
|
||||
int split = rules.IndexOf(". ", System.StringComparison.Ordinal);
|
||||
body.Add(Text(split < 0 ? rules : rules.Substring(0, split + 1), "software-effect"));
|
||||
if (split >= 0) body.Add(Text(rules.Substring(split + 2), "software-conditions"));
|
||||
int split = displayRules.IndexOf(". ", System.StringComparison.Ordinal);
|
||||
body.Add(Text(split < 0 ? displayRules : displayRules.Substring(0, split + 1), "software-effect"));
|
||||
if (split >= 0)
|
||||
{
|
||||
string details = displayRules.Substring(split + 2);
|
||||
if (python)
|
||||
{
|
||||
// Give each rule its own line without abbreviating or hiding restrictions.
|
||||
var sentences = details.Split(new[] { ". " }, System.StringSplitOptions.None);
|
||||
for (int i = 0; i < sentences.Length; i++)
|
||||
{
|
||||
string line = sentences[i] + (i < sentences.Length - 1 ? "." : "");
|
||||
var rule = new VisualElement();
|
||||
rule.AddToClassList("software-python-rule");
|
||||
rule.Add(Text(line, "software-conditions"));
|
||||
body.Add(rule);
|
||||
}
|
||||
}
|
||||
else body.Add(Text(details, "software-conditions"));
|
||||
}
|
||||
target.Add(body);
|
||||
|
||||
var footer = new VisualElement();
|
||||
|
||||
Reference in New Issue
Block a user