Revamp UI a whole lot
This commit is contained in:
@@ -216,14 +216,9 @@ namespace KernelPanic.Run
|
||||
string originalBuild = BuildSignature(combat.RunConfig);
|
||||
var view = FindFirstObjectByType<CombatSceneController>();
|
||||
var previewRoot = view.GetComponent<UIDocument>().rootVisualElement;
|
||||
var executionPreview = previewRoot.Q<Button>("OpenExecutionPreview");
|
||||
int drawsBeforePreview = RandomRoll.DrawCount;
|
||||
Submit(executionPreview);
|
||||
yield return null;
|
||||
var previewContents = previewRoot.Q("ExecutionPreviewPopup") ?? executionPreview;
|
||||
Require(RandomRoll.DrawCount == drawsBeforePreview && previewContents.Q<Label>(className: "terminal-body") != null,
|
||||
"Execution preview changed RNG or did not render its explanation.");
|
||||
Submit(previewRoot.Q<Button>("CloseExecutionPreview"));
|
||||
Require(previewRoot.Q<Button>("OpenExecutionPreview") == null &&
|
||||
previewRoot.Q<Button>("OpenTurnResolution") == null,
|
||||
"Obsolete combat popup controls are still present.");
|
||||
if (Environment.GetCommandLineArgs().Contains("--kernel-panic-campaign-smoke"))
|
||||
{
|
||||
var campaign = CampaignScenario(combat, view);
|
||||
@@ -493,15 +488,12 @@ namespace KernelPanic.Run
|
||||
if (packageFixture)
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(1);
|
||||
var packagePanel = document.rootVisualElement.Q("CombatPackages");
|
||||
packagePanel.GetFirstAncestorOfType<ScrollView>().ScrollTo(packagePanel);
|
||||
var packageCapture = CapturePanel(document, "package-readiness");
|
||||
while (packageCapture.MoveNext()) yield return packageCapture.Current;
|
||||
Call(view, "HandlePackageActivated", new PackageActivation("pkg_mint_timeshift", "Timeshift", "Full recovery notification with enough detail to overflow a narrow screen if it wraps"));
|
||||
Call(view, "HandlePackageActivated", new PackageActivation("pkg_mint_cinnamon", "Cinnamon", "JavaScript damage increased for this round"));
|
||||
yield return null;
|
||||
packagePanel.GetFirstAncestorOfType<ScrollView>().ScrollTo(packagePanel);
|
||||
packageCapture = CapturePanel(document, "package-notification");
|
||||
var hostPanel = document.rootVisualElement.Q(className: "player-panel");
|
||||
hostPanel.GetFirstAncestorOfType<ScrollView>().ScrollTo(hostPanel);
|
||||
var packageCapture = CapturePanel(document, "package-notification");
|
||||
while (packageCapture.MoveNext()) yield return packageCapture.Current;
|
||||
}
|
||||
// Isolated fixture gives the presentation time to display persistent state without ending the wave.
|
||||
@@ -525,11 +517,9 @@ namespace KernelPanic.Run
|
||||
Require(saveControl.worldBound.height > 0 && document.rootVisualElement.worldBound.Contains(saveControl.worldBound.min)
|
||||
&& document.rootVisualElement.worldBound.Contains(saveControl.worldBound.max), "Planning save control is clipped.");
|
||||
var capture = CapturePanel(document, "planning-save"); while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(document.rootVisualElement.Q<Button>("OpenExecutionPreview"));
|
||||
Require(document.rootVisualElement.Q("ExecutionPreviewPopup") != null, "Preview dialog did not open.");
|
||||
capture = CapturePanel(document, "execution-preview"); while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(document.rootVisualElement.Q<Button>("CloseExecutionPreview"));
|
||||
Require(RandomRoll.DrawCount == draws, "Preview consumed randomness.");
|
||||
Require(document.rootVisualElement.Q<Button>("OpenExecutionPreview") == null &&
|
||||
document.rootVisualElement.Q("ExecutionPreviewPopup") == null,
|
||||
"Execution preview should not interrupt combat.");
|
||||
Submit(document.rootVisualElement.Q<Button>("SaveCombatButton"));
|
||||
menu = null;
|
||||
while (menu == null) { yield return null; menu = FindFirstObjectByType<MainMenuController>(); }
|
||||
@@ -548,18 +538,17 @@ namespace KernelPanic.Run
|
||||
Require(combat.Go.Active.Count == 1 && combat.Go.Active[0].RemainingTicks == 2, "Resumed goroutine did not tick exactly once.");
|
||||
Require(combat.InterpreterQueue.Count == 0, "Resumed FIFO did not drain.");
|
||||
_stage = "damage explanation";
|
||||
Submit(document.rootVisualElement.Q<Button>("OpenTurnResolution"));
|
||||
var resolution = document.rootVisualElement.Q("TurnResolutionPopup");
|
||||
Require(resolution != null, "Results dialog did not open.");
|
||||
capture = CapturePanel(document, "turn-resolution"); while (capture.MoveNext()) yield return capture.Current;
|
||||
var explanation = resolution.Query<Foldout>().ToList().FirstOrDefault(f => f.text == "Damage calculation / recent hits");
|
||||
Require(explanation != null, "Damage calculation foldout is missing."); explanation.value = true;
|
||||
var journal = document.rootVisualElement.Q<Foldout>(className: "combat-journal");
|
||||
Require(journal != null, "Combat journal is missing.");
|
||||
journal.value = true;
|
||||
yield return null;
|
||||
capture = CapturePanel(document, "turn-journal"); while (capture.MoveNext()) yield return capture.Current;
|
||||
var explanation = journal.Query<Foldout>(className: "journal-action-result").ToList()
|
||||
.FirstOrDefault(f => f.Q<Label>(className: "journal-action-damage") != null);
|
||||
Require(explanation != null, "Journal damage calculation is missing."); explanation.value = true;
|
||||
yield return new WaitForSecondsRealtime(1);
|
||||
Require(resolution.Q<ScrollView>("ResolutionActions").contentViewport.worldBound.height > 200, "Damage results viewport is too small.");
|
||||
explanation.GetFirstAncestorOfType<ScrollView>()?.ScrollTo(explanation);
|
||||
capture = CapturePanel(document, "damage-calculation"); while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(document.rootVisualElement.Q<Button>("CloseTurnResolution"));
|
||||
Require(document.rootVisualElement.Q("TurnResolutionPopup") == null, "Results dialog did not close.");
|
||||
_stage = "deck analysis and upgrade comparison";
|
||||
Field<System.Collections.Generic.List<EnemyInstance>>(combat, "_enemies").Clear(); Call(combat, "CheckWin");
|
||||
while (!combat.AwaitingWaveContinue) yield return null;
|
||||
@@ -706,14 +695,13 @@ namespace KernelPanic.Run
|
||||
capturedResolution = true;
|
||||
var trace = Field<CombatExecutionTrace>(view, "_executionTrace");
|
||||
Require(trace.Actions.Count > 0 && trace.Actions.Any(a => a.Complete), "Practice has no observed resolution results.");
|
||||
var resolution = root.Q<Button>("OpenTurnResolution");
|
||||
Require(resolution != null, "Turn-resolution view is missing.");
|
||||
Submit(resolution);
|
||||
for (int frame = 0; frame < 4; frame++) yield return null;
|
||||
var journal = root.Q<Foldout>(className: "combat-journal");
|
||||
Require(journal != null, "Combat journal is missing.");
|
||||
journal.value = true;
|
||||
for (int frame = 0; frame < 4; frame++) yield return null;
|
||||
var capture = CapturePanel(document, "training-" + language + "-resolution");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(root.Q<Button>("CloseTurnResolution"));
|
||||
journal.value = false;
|
||||
}
|
||||
if (combat.PendingGoroutineCard != null)
|
||||
{
|
||||
@@ -1121,16 +1109,13 @@ namespace KernelPanic.Run
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
var widget = root.Q<Button>("DailyQuestWidget");
|
||||
var homeScroll = root.Q<ScrollView>(className: "home-scroll");
|
||||
if (Screen.width >= 1280)
|
||||
Require(widget.worldBound.yMax <= homeScroll.contentViewport.worldBound.yMax + 1,
|
||||
"Quest widget must fit below neofetch without scrolling at 1280x720.");
|
||||
else
|
||||
if (widget.worldBound.yMax > homeScroll.contentViewport.worldBound.yMax + 1)
|
||||
{
|
||||
homeScroll.ScrollTo(widget);
|
||||
capture = CapturePanel(document, "quest-widget");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
}
|
||||
Require(root.Q<Label>("DailyQuestCompleted").text == "1/3 completed", "Quest fixture progress is wrong.");
|
||||
Require(root.Q<Label>("DailyQuestCompleted").text == "1/5 completed", "Quest fixture progress is wrong.");
|
||||
Require(root.Q<Label>("DailyQuestRewardReady").text == "1 reward ready"
|
||||
&& root.Q<Label>("DailyQuestInspect").text == "> claim available rewards", "Claimable widget feedback is wrong.");
|
||||
var widgetPosition = widget.worldBound.center;
|
||||
@@ -1145,6 +1130,7 @@ namespace KernelPanic.Run
|
||||
var saved = new SaveService().Load();
|
||||
var reward = DailyQuests.Reward(DailyQuestKind.Waves);
|
||||
Require(saved.bandwidthBalance == reward.Bandwidth && saved.entropyBalance == reward.Entropy
|
||||
&& saved.commitsBalance == DailyQuests.CommitReward(DailyQuestKind.Waves)
|
||||
&& !root.Q<Button>("ClaimDailyQuestWaves").enabledSelf, "Quest claim did not commit exactly once.");
|
||||
Require(root.Q<Button>("ClaimDailyQuestWaves").text == "[ CLAIMED ]"
|
||||
&& root.Q<Label>("DailyQuestFeedback").text.Contains($"+{reward.Bandwidth} Bandwidth, +{reward.Entropy} Entropy deposited."),
|
||||
@@ -1229,10 +1215,11 @@ namespace KernelPanic.Run
|
||||
if (!capturedPreview && combat.InterpreterQueue.Count > 0)
|
||||
{
|
||||
capturedPreview = true;
|
||||
Submit(document.rootVisualElement.Q<Button>("OpenExecutionPreview"));
|
||||
var capture = CapturePanel(document, "execution-preview");
|
||||
var journal = document.rootVisualElement.Q<Foldout>(className: "combat-journal");
|
||||
journal.value = true;
|
||||
var capture = CapturePanel(document, "combat-journal");
|
||||
while (capture.MoveNext()) yield return capture.Current;
|
||||
Submit(document.rootVisualElement.Q<Button>("CloseExecutionPreview"));
|
||||
journal.value = false;
|
||||
}
|
||||
if (run.CurrentWaveNumber == RunJourney.BossWave && !capturedBoss)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace KernelPanic.Run
|
||||
public int bits;
|
||||
public int bandwidth;
|
||||
public int entropy;
|
||||
public int commits;
|
||||
public int maxUptimeBonus;
|
||||
public int maxCyclesBonus;
|
||||
public int ramBonus;
|
||||
@@ -77,7 +78,7 @@ namespace KernelPanic.Run
|
||||
}
|
||||
Require(Guid.TryParseExact(runId, "N", out _), "Invalid run identity.");
|
||||
Require(wave >= (fullCombat == null ? 2 : 1) && wave <= 100000 && wavesCleared == wave - 1, "Invalid checkpoint wave.");
|
||||
Require(bits >= 0 && bandwidth >= 0 && entropy >= 0 && rerolls >= 0, "Invalid checkpoint balances.");
|
||||
Require(bits >= 0 && bandwidth >= 0 && entropy >= 0 && commits >= 0 && rerolls >= 0, "Invalid checkpoint balances.");
|
||||
Require(maxUptimeBonus >= 0 && maxCyclesBonus >= 0 && ramBonus >= 0, "Invalid run upgrades.");
|
||||
Require(shopRandomDraws >= 0 && shopRandomDraws <= 10000000, "Invalid shop random cursor.");
|
||||
Require(Enum.IsDefined(typeof(Language), primaryLanguage) && Enum.IsDefined(typeof(Language), secondaryLanguage)
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace KernelPanic.Run
|
||||
private int _wavesCleared;
|
||||
private int _accruedBandwidth;
|
||||
private int _accruedEntropy;
|
||||
private int _accruedCommits;
|
||||
private bool _repositoryVisitActive;
|
||||
private bool _rewardsSettled;
|
||||
|
||||
@@ -52,6 +53,7 @@ namespace KernelPanic.Run
|
||||
public int WavesCleared => _wavesCleared;
|
||||
public int AccruedBandwidth => _accruedBandwidth;
|
||||
public int AccruedEntropy => _accruedEntropy;
|
||||
public int AccruedCommits => _accruedCommits;
|
||||
public bool RewardsSettled => _rewardsSettled;
|
||||
public string RunId { get; private set; }
|
||||
public bool IsSuspended { get; private set; }
|
||||
@@ -242,6 +244,7 @@ namespace KernelPanic.Run
|
||||
_wavesCleared = 0;
|
||||
_accruedBandwidth = 0;
|
||||
_accruedEntropy = 0;
|
||||
_accruedCommits = 0;
|
||||
_rewardsSettled = false;
|
||||
ApplyKernelPackageBonuses(config);
|
||||
InitializeRunDeck(config);
|
||||
@@ -266,7 +269,7 @@ namespace KernelPanic.Run
|
||||
startingCards = CurrentConfig.StartingDeck.Select(card => card.Id).ToList(),
|
||||
deck = _runDeck.Select(CheckpointCard.Capture).ToList(), soldKeys = _soldOfferKeys.ToList(),
|
||||
wave = currentWaveNumber, wavesCleared = _wavesCleared, bits = _bits,
|
||||
bandwidth = _accruedBandwidth, entropy = _accruedEntropy,
|
||||
bandwidth = _accruedBandwidth, entropy = _accruedEntropy, commits = _accruedCommits,
|
||||
maxUptimeBonus = _maxUptimeBonus, maxCyclesBonus = _maxCyclesBonus, ramBonus = _ramBonus,
|
||||
rerolls = _rerollsThisVisit, shopRandomDraws = _repositoryRandom.Draws,
|
||||
version = 6, journey = Journey.Copy(), performance = Performance.Copy(),
|
||||
@@ -307,6 +310,7 @@ namespace KernelPanic.Run
|
||||
_bits = snapshot.bits;
|
||||
_accruedBandwidth = snapshot.bandwidth;
|
||||
_accruedEntropy = snapshot.entropy;
|
||||
_accruedCommits = snapshot.commits;
|
||||
_maxUptimeBonus = snapshot.maxUptimeBonus;
|
||||
_maxCyclesBonus = snapshot.maxCyclesBonus;
|
||||
_ramBonus = snapshot.ramBonus;
|
||||
@@ -493,7 +497,7 @@ namespace KernelPanic.Run
|
||||
}
|
||||
|
||||
_rewardsSettled = true;
|
||||
return bandwidth > 0 || entropy > 0;
|
||||
return bandwidth > 0 || entropy > 0 || _accruedCommits > 0;
|
||||
}
|
||||
|
||||
public void MarkRunRewardsSettled()
|
||||
@@ -536,6 +540,7 @@ namespace KernelPanic.Run
|
||||
{
|
||||
_accruedBandwidth += CalculateBandwidthReward(clearedWave);
|
||||
_accruedEntropy += CalculateEntropyReward(clearedWave);
|
||||
_accruedCommits += CalculateCommitReward(clearedWave);
|
||||
}
|
||||
currentWaveNumber = Mathf.Max(currentWaveNumber + 1, payload.WaveNumber + 1);
|
||||
EnsureRouteSelection();
|
||||
@@ -572,6 +577,12 @@ namespace KernelPanic.Run
|
||||
return waveNumber >= CombatTuning.EntropyStartWave ? Mathf.Max(0, CombatTuning.EntropyPerWave) : 0;
|
||||
}
|
||||
|
||||
private static int CalculateCommitReward(int waveNumber)
|
||||
{
|
||||
if (waveNumber <= 0 || waveNumber % 5 != 0) return 0;
|
||||
return waveNumber == RunJourney.BossWave ? 2 : 1;
|
||||
}
|
||||
|
||||
private void InitializeRunDeck(RunConfig config)
|
||||
{
|
||||
_runDeck.Clear();
|
||||
|
||||
Reference in New Issue
Block a user