Unlock expanded venues and manage concurrent fleet voyages

This commit is contained in:
josh
2026-11-28 15:36:55 -05:00
parent 636a0e2cf8
commit a9472edc35
33 changed files with 2094 additions and 363 deletions

View File

@@ -61,7 +61,7 @@ namespace Soundings
root = document.rootVisualElement;
root.style.flexGrow = 1;
root.style.unityFontDefinition = interfaceFont;
foreach (string sheet in new[] { "Soundings", "Shipwork", "Ledger", "FirstVoyageGuide", "Passage", "ServiceControls" })
foreach (string sheet in new[] { "Soundings", "Shipwork", "Ledger", "FirstVoyageGuide", "Passage", "ServiceControls", "FleetOverview" })
{
StyleSheet stylesheet = Resources.Load<StyleSheet>(sheet);
if (stylesheet != null)
@@ -106,6 +106,7 @@ namespace Soundings
private void StartCompany(bool financed)
{
ResetFleetPassages();
company = Company.Start(financed);
title = paused = fleetOpen = shipActionsOpen = false;
page = financed ? 2 : 0;
@@ -118,7 +119,7 @@ namespace Soundings
worldChart = false;
ResetWeatherSelection();
tool = Facility.Cabin;
systemTools = false;
deckTools = DeckTools.GuestFacilities;
shipName = "Peregrine";
pendingStart = null;
harbor.ResetView(true);
@@ -297,7 +298,8 @@ namespace Soundings
AddHarbor(world);
if (page == 0 || underway != null)
{
AttachCamera(world);
if (!fleetOpen)
AttachCamera(world);
Shade(shell, true, (0f, new Color32(5, 13, 19, 177)), (.23f, new Color32(5, 13, 19, 4)),
(.67f, new Color32(5, 13, 19, 4)), (1f, new Color32(5, 13, 19, 231)));
}
@@ -307,7 +309,7 @@ namespace Soundings
var scene = Add(shell, "game-scene");
scene.pickingMode = PickingMode.Ignore;
scene.SetEnabled(!paused);
scene.SetEnabled(!paused && !fleetOpen);
if (underway != null)
{
DrawUnderway(scene);
@@ -327,7 +329,7 @@ namespace Soundings
var hud = Add(shell, "game-hud");
hud.pickingMode = PickingMode.Ignore;
hud.SetEnabled(!paused);
hud.SetEnabled(!paused && !fleetOpen);
var hudLeft = Add(hud, "hud-left");
Button menu = Action("", () => { paused = true; Render(); }, "menu-icon", "company-menu");
menu.tooltip = "Pause menu (Esc)";
@@ -336,21 +338,15 @@ namespace Soundings
AddDisplay(hudLeft, "Soundings", "hud-brand");
var instruments = Add(hud, "hud-instruments");
HeadMetric(instruments, "Day", company.Day.ToString("00"));
HeadMetric(instruments, "Reputation", company.Reputation.ToString());
HeadMetric(instruments, "Treasury", Money(company.Cash), "hud-money");
fleetDayReadout = HeadMetric(instruments, "Day", company.Day.ToString("00"));
fleetReputationReadout = HeadMetric(instruments, "Reputation", company.Reputation.ToString());
fleetTreasuryReadout = HeadMetric(instruments, "Treasury", Money(company.Cash), "hud-money");
RefreshFleetMetrics();
Button fleet = Action($"Fleet {company.Fleet.Count}", ToggleFleetOverview, "fleet-toggle", "fleet-toggle");
fleet.tooltip = "Fleet overview (F2)";
hudLeft.Add(fleet);
if (underway == null)
{
hudLeft.Add(Action($"Fleet {company.Fleet.Count}", () =>
{
fleetOpen = !fleetOpen;
shipActionsOpen = false;
Render();
}, "fleet-toggle", "fleet-toggle"));
DrawHotbar(shell).SetEnabled(!paused);
if (fleetOpen)
DrawFleet(shell).SetEnabled(!paused);
}
DrawHotbar(shell).SetEnabled(!paused && !fleetOpen);
if (!paused && !fleetOpen)
DrawGuide(shell);
@@ -361,6 +357,9 @@ namespace Soundings
toast.pickingMode = PickingMode.Ignore;
AddNotice(toast);
}
if (fleetOpen)
DrawFleetOverview(shell).SetEnabled(!paused);
}
private void DrawHarborScene(VisualElement scene)
@@ -425,32 +424,6 @@ namespace Soundings
return bar;
}
private VisualElement DrawFleet(VisualElement shell)
{
var popover = Add(shell, "fleet-manifest");
AddDisplay(popover, "Fleet", "fleet-title");
if (company.Fleet.Count == 0)
AddText(popover, "No ships in service.", "muted");
for (int i = 0; i < company.Fleet.Count; i++)
{
int selected = i;
Ship ship = company.Fleet[i];
Button entry = Action("", () =>
{
company.SelectedShip = selected;
deckIndex = 0;
fleetOpen = false;
ResetItinerary();
Apply(null, null);
}, i == company.SelectedShip ? "fleet-entry fleet-active" : "fleet-entry", "fleet-" + i);
AddText(entry, ship.Name, "fleet-name");
AddText(entry, Market.Ports[ship.Port].Name, "muted");
popover.Add(entry);
}
popover.Add(Action("Close fleet", () => { fleetOpen = false; Render(); }, "fleet-close", "fleet-close"));
return popover;
}
private void DrawPause()
{
var shade = Add(root, "pause-overlay");
@@ -459,7 +432,7 @@ namespace Soundings
AddDisplay(menu, "Paused", "pause-title");
menu.Add(Action("Resume", () => { paused = false; Render(); }, "primary pause-command", "resume-game"));
menu.Add(Action("Restart first voyage guide", RestartGuide, "pause-command", "restart-guide"));
if (underway == null)
if (fleetPassages.Count == 0 && underway == null)
{
menu.Add(Action("Title screen", () =>
{
@@ -576,11 +549,11 @@ namespace Soundings
AddText(parent, notice, warning ? "notice warning" : "notice");
}
private static void HeadMetric(VisualElement parent, string label, string value, string modifier = "")
private static Label HeadMetric(VisualElement parent, string label, string value, string modifier = "")
{
var metric = Add(parent, "hud-metric");
AddText(metric, label, "eyebrow hud-label");
AddText(metric, value, "hud-value " + modifier);
return AddText(metric, value, "hud-value " + modifier);
}
private static void Classes(VisualElement element, string classes)