using UnityEngine; using UnityEngine.UIElements; namespace Soundings { public sealed partial class SoundingsApp { private VisualElement stationPrompt; private Label stationTitle, stationCommand, stationFeedback, crewCallReadout; private float stationFeedbackUntil; private string stationFeedbackText; private void DrawStationInteractions(VisualElement overlay) { stationPrompt = null; if (!passageBridge && !passageExploring) return; var reticle = Add(overlay, "station-reticle"); reticle.pickingMode = PickingMode.Ignore; stationPrompt = Add(overlay, "station-prompt"); stationPrompt.pickingMode = PickingMode.Ignore; stationTitle = AddText(stationPrompt, "", "station-title"); stationCommand = AddText(stationPrompt, "", "station-command"); stationFeedback = AddText(overlay, "", "station-feedback"); stationFeedback.pickingMode = PickingMode.Ignore; UpdateStationInteractions(); } private void UpdateStationInteractions() { if (stationPrompt == null || livePassage == null) return; bool visible = harbor.TryGetFacingStation(out StationKind station); stationPrompt.style.display = visible ? DisplayStyle.Flex : DisplayStyle.None; if (visible) { bool requested = livePassage.CrewCall == station; string action = station == StationKind.Helm && passageHelm.Manual ? "Return to autopilot" : livePassage.StationAction(station); string blocker = station == StationKind.Helm ? null : livePassage.StationBlock(station); SetPassageText(stationTitle, requested ? $"{OnboardSession.StationName(station)} · Crew call" : OnboardSession.StationName(station)); SetPassageText(stationCommand, blocker ?? $"[F] {action}"); stationPrompt.EnableInClassList("station-requested", requested); } bool showResult = !string.IsNullOrEmpty(stationFeedbackText) && Time.unscaledTime < stationFeedbackUntil; stationFeedback.style.display = showResult ? DisplayStyle.Flex : DisplayStyle.None; if (showResult) SetPassageText(stationFeedback, stationFeedbackText); } private bool UseFacingStation() { if (livePassage == null || !harbor.TryGetFacingStation(out StationKind station)) return false; if (station == StationKind.Helm) { ToggleHelm(); ShowStationResult(passageHelm.Manual ? "Manual helm engaged" : "Autopilot engaged", true); return true; } bool worked = livePassage.TryWorkStation(station, out string result); if (worked) AnnounceStation(station); if (worked && station >= StationKind.Engine && station <= StationKind.Waste) { int area = (int)station - (int)StationKind.Engine; if (area != passageServiceArea) { passageServiceArea = area; Render(); } } ShowStationResult(result, worked); RefreshPassageBusiness(); return worked; } private void ShowStationResult(string result, bool worked) { stationFeedbackText = result; stationFeedbackUntil = Time.unscaledTime + 3.4f; if (worked) passageAudio.Confirm(); UpdateStationInteractions(); } private void UpdateCrewCall() { if (crewCallReadout == null) return; string text; if (livePassage.CrewCall is StationKind station) text = $"Crew call · {OnboardSession.StationName(station)} · {StationDeck(station)} · {livePassage.CrewRoundsLeft} rounds"; else if (livePassage.CrewRequestsCompleted > 0) text = $"Crew calls answered · {livePassage.CrewRequestsCompleted}"; else text = ""; SetPassageText(crewCallReadout, text); crewCallReadout.style.display = text.Length == 0 ? DisplayStyle.None : DisplayStyle.Flex; crewCallReadout.EnableInClassList("crew-call-urgent", livePassage.CrewRoundsLeft is > 0 and <= 2); } private string StationDeck(StationKind station) { if (station <= StationKind.Waste) return "Service deck"; (Facility room, Facility expansion, Facility premium) = station switch { StationKind.Cabins => (Facility.Cabin, Facility.Suite, Facility.GrandSuite), StationKind.Dining => (Facility.Dining, Facility.Restaurant, Facility.Restaurant), StationKind.Bar => (Facility.Bar, Facility.CocktailLounge, Facility.CocktailLounge), StationKind.Stage => (Facility.Entertainment, Facility.GrandTheater, Facility.GrandTheater), _ => (Facility.Amenity, Facility.ResortPool, Facility.ResortPool) }; for (int i = 0; i < Ship.Decks.Count; i++) foreach (Facility cell in Ship.Decks[i].Cells) if (cell == room || cell == expansion || cell == premium) return $"Deck {i + 1}"; return "Guest decks"; } } }