57 lines
3.1 KiB
C#
57 lines
3.1 KiB
C#
using System;
|
|
using KernelPanic.Combat;
|
|
using KernelPanic.Run;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace KernelPanic.UI
|
|
{
|
|
/// <summary>Repository decisions; all rewards and transitions remain in the run/combat model.</summary>
|
|
internal static class RunRouteView
|
|
{
|
|
public static VisualElement Build(RunManager run, CombatManager combat)
|
|
{
|
|
var section = TerminalLayout.Section(run.CampaignChoicePending ? "KERNEL SECURED" : "Next route", "RunRouteChoices");
|
|
section.AddToClassList("run-route-section");
|
|
if (!string.IsNullOrEmpty(run.Journey.lastReward)) section.Add(TerminalLayout.BodyText(run.Journey.lastReward));
|
|
if (run.CampaignChoicePending)
|
|
{
|
|
section.Add(TerminalLayout.BodyText("Five waves cleared. Finish this campaign and bank your rewards, or keep this build running in endless mode. Rewards are saved when the run ends."));
|
|
section.Add(Action("Finish campaign", "FinishCampaignButton", () => combat.CompleteCampaign()));
|
|
section.Add(Action("Continue into endless", "ContinueEndlessButton", () => combat.ContinueEndless()));
|
|
return section;
|
|
}
|
|
var plan = EncounterDirector.Plan(run.CurrentWaveNumber, run.Journey.selectedRoute);
|
|
section.Add(TerminalLayout.BodyText($"Wave {run.CurrentWaveNumber}: {plan.Title}"));
|
|
section.Add(TerminalLayout.BodyText(plan.Advice));
|
|
var choices = new VisualElement();
|
|
choices.AddToClassList("route-choices");
|
|
AddChoice(choices, run, WaveRoute.Repair, "Repair stop",
|
|
$"Restore up to {RunJourney.RepairUptime} Uptime on departure. Fight the standard encounter.");
|
|
AddChoice(choices, run, WaveRoute.Challenge, "Elite detour",
|
|
$"An extra elite Daemon joins the encounter. On clear: +{RunJourney.ChallengeBits} Bits and +1 draw on the first eligible deck card without a draw rider; +{RunJourney.ChallengeBits} extra Bits if none qualify.");
|
|
section.Add(choices);
|
|
section.Add(TerminalLayout.BodyText("Choose freely before booting. Repairs and difficulty apply only when you leave; the elite reward requires clearing the wave."));
|
|
return section;
|
|
}
|
|
|
|
private static void AddChoice(VisualElement parent, RunManager run, WaveRoute route, string title, string detail)
|
|
{
|
|
var card = new VisualElement();
|
|
card.AddToClassList("route-choice");
|
|
bool selected = run.Journey.selectedRoute == route;
|
|
card.EnableInClassList("route-selected", selected);
|
|
card.Add(Action((selected ? "[selected] " : "") + title, "Route" + route,
|
|
() => run.SelectRoute(route)));
|
|
card.Add(TerminalLayout.BodyText(detail));
|
|
parent.Add(card);
|
|
}
|
|
|
|
private static Button Action(string title, string name, Action action)
|
|
{
|
|
var button = new Button(action) { text = title, name = name };
|
|
button.AddToClassList("primary-action");
|
|
return button;
|
|
}
|
|
}
|
|
}
|