using System; using System.Collections; using System.IO; using UnityEngine; using UnityEngine.UIElements; namespace Soundings { public sealed partial class SoundingsApp { private IEnumerator VisualSmoke() { string[] args = Environment.GetCommandLineArgs(); int index = Array.IndexOf(args, "-soundings-smoke"); if (index + 1 >= args.Length) { Application.Quit(1); yield break; } string directory = args[index + 1]; Directory.CreateDirectory(directory); for (int port = 0; port < Market.Ports.Count; port++) { if (!CheckSmoke(PassageAudio.LoadPortClip("Departure", port) is { length: > 1 } && PassageAudio.LoadPortClip("Approach", port) is { length: > 1 }, "Named PA recordings for " + Market.Ports[port].Name)) yield break; } Vector2[] pacific = MapPaths(new[] { 15, 16 })[0]; if (!CheckSmoke(Mathf.Abs(pacific[MapSamples].x - pacific[0].x) < 45, "Voyage map wraps the date line")) yield break; yield return CaptureSmoke(directory, "01-title"); if (!CheckSmoke(guidedCareer, "The guide is on by default") || !SubmitSmoke("guide-toggle") || !CheckSmoke(!guidedCareer, "Guide can be turned off at title") || !SubmitSmoke("guide-toggle") || !SubmitSmoke("start-used") || !CheckSmoke(Ship?.Name == "MV Meridian" && guideContext == GuideStep.SetCourse, "Guided used start")) yield break; yield return CaptureSmoke(directory, "02-harbor"); if (!SubmitSmoke("plan-voyage") || !CheckSmoke(page == 3 && destination == 1 && guideContext == GuideStep.Fare, "Set course and fare guide")) yield break; yield return CaptureSmoke(directory, "03-passage-chart"); int fare = Ship.Fare; if (!SubmitSmoke("fare-plus") || !CheckSmoke(Ship.Fare == fare + 50 && guideContext == GuideStep.CastOff, "Fare control and departure guide")) yield break; if (!SubmitSmoke("port-plan-open")) yield break; IntegerField provisioning = root.Q("port-food-units"); if (!CheckSmoke(provisioning != null && provisioning.value > 0, "Dockside orders show recommended provisions")) yield break; provisioning.value = 1120; if (!SubmitSmoke("port-program-1") || !CheckSmoke(portFoodOrder == 1120 && portProgram == EntertainmentProgram.LiveMusic, "Order an exact food quantity and book local musicians")) yield break; yield return CaptureSmoke(directory, "03a-dockside-orders"); if (!SubmitSmoke("port-plan-close")) yield break; if (!SubmitSmoke("weather-swell") || !CheckSmoke(PassageWeatherFor(0, 1) == WeatherCondition.Swell, "Select forecast conditions") || !SubmitSmoke("weather-calm")) yield break; if (!SubmitSmoke("dispatch") || !CheckSmoke(underway != null && livePassage != null && Ship.Port == 0 && company.Voyages == 0 && PassageDuration(underway) >= 120 && livePassage.Assisted && underway.Weather == WeatherCondition.Calm && guideContext == GuideStep.AtSea && root.Q