Make voyages active with dockside orders, crew calls, and ship PA

This commit is contained in:
josh
2026-11-27 23:14:38 -05:00
parent 7951e1c878
commit cc7620c431
71 changed files with 2723 additions and 233 deletions

View File

@@ -0,0 +1,42 @@
using System;
namespace Soundings
{
public sealed partial class OnboardSession
{
private int performanceStarted = -1;
private EntertainmentProgram BookedProgram => Quote.Plan?.Program ?? EntertainmentProgram.Shipboard;
private int PerformanceRounds => PortPlanning.ShowRounds(BookedProgram);
public bool PerformanceActive => performanceStarted >= 0 && tick < performanceStarted + PerformanceRounds;
internal bool CanAdvancePerformance => BookedProgram != EntertainmentProgram.Shipboard && performanceStarted < 0
&& tick + PerformanceRounds < ticks;
internal string PerformanceLabel
{
get
{
if (BookedProgram == EntertainmentProgram.Shipboard)
return "Shipboard sets";
string title = PortPlanning.ProgramLabel(BookedProgram);
if (PerformanceActive)
return $"{title} · now playing ({performanceStarted + PerformanceRounds - tick} rounds)";
return $"{title} · {(performanceStarted < 0 ? "up next" : "finished")}";
}
}
internal bool TryAdvancePerformance()
{
if (!CanAdvancePerformance)
return false;
performanceStarted = tick;
Measure(false);
return true;
}
private void AdvancePerformance()
{
if (BookedProgram != EntertainmentProgram.Shipboard && performanceStarted < 0
&& tick >= Math.Min(ticks - PerformanceRounds, ticks * PortPlanning.ShowTime(BookedProgram)))
performanceStarted = tick;
}
}
}