private IEnumerator FlyButton() { ControllerEventHandler.PauseEvents(); ScreenFader.FadeOut(Color.black, 0.85f); yield return(new WaitForSeconds(1f)); if (PilotSaveManager.currentScenario.equipConfigurable) { LoadingSceneController.LoadSceneImmediate("VehicleConfiguration"); } else { BGMManager.FadeOut(2f); Loadout loadout = new Loadout(); loadout.normalizedFuel = PilotSaveManager.currentScenario.forcedFuel; loadout.hpLoadout = new string[PilotSaveManager.currentVehicle.hardpointCount]; loadout.cmLoadout = new int[] { 99999, 99999 }; if (PilotSaveManager.currentScenario.forcedEquips != null) { foreach (CampaignScenario.ForcedEquip forcedEquip in PilotSaveManager.currentScenario.forcedEquips) { loadout.hpLoadout[forcedEquip.hardpointIdx] = forcedEquip.weaponName; } } VehicleEquipper.loadout = loadout; if (PilotSaveManager.currentCampaign.isCustomScenarios) { VTScenario.LaunchScenario(VTResources.GetScenario(PilotSaveManager.currentScenario.scenarioID, PilotSaveManager.currentCampaign), false); } else { LoadingSceneController.LoadScene(PilotSaveManager.currentScenario.mapSceneName); } } ControllerEventHandler.UnpauseEvents(); }
private IEnumerator LoadFromFile() { ConfigNode qsNode = ConfigNode.LoadFromFile(PilotSaveManager.saveDataPath + "/quicksave.cfg"); ConfigNode config = qsNode.GetNode("ModdedSaveFile"); foreach (var thing in config.GetNodes()) { Debug.Log(thing + "\n"); } string scenarioID = config.GetValue <String>("scenarioID"); string campaignID = config.GetValue <String>("campaignID"); Campaign campaign = new Campaign(); campaign.campaignID = campaignID; switch (config.GetValue <string>("campaignType")) { case "builtIn": campaign.isBuiltIn = true; break; case "SSS": campaign.isSteamworksStandalone = true; break; case "SS": campaign.isSteamworksStandalone = true; break; // Other is handled by not changing any vars. } VTScenarioInfo VTSI = VTResources.GetScenario(scenarioID, campaign); if (VTSI == null) { Log(" failed"); } else { if (VTResources.GetBuiltInCampaigns() != null) { using (List <VTCampaignInfo> .Enumerator enumerator = VTResources.GetBuiltInCampaigns().GetEnumerator()) { while (enumerator.MoveNext()) { VTCampaignInfo vtcampaignInfo = enumerator.Current; if (vtcampaignInfo.campaignID == campaignID) { Debug.Log("Setting Campaign"); PilotSaveManager.currentCampaign = vtcampaignInfo.ToIngameCampaign(); Debug.Log("Setting Vehicle"); PilotSaveManager.currentVehicle = VTResources.GetPlayerVehicle(vtcampaignInfo.vehicle); Debug.Log("Set campaign"); break; } } } } foreach (CampaignScenario campaignScenario in PilotSaveManager.currentCampaign.missions) { if (campaignScenario.scenarioID == scenarioID) { PilotSaveManager.currentScenario = campaignScenario; Debug.Log("Set scenario"); break; } } VTScenario.LaunchScenario(VTSI, false); while (VTMapManager.fetch == null || !VTMapManager.fetch.scenarioReady) { yield return(null); } Debug.Log("Quick Loading"); QuicksaveManager.instance.Quickload(); } }