public static bool Prefix(PlayerSpawn __instance)
    {
        if (PlayerManager.selectedVehicle == "")
        {
            Debug.LogError("selected vehicle is empty");
        }
        if (PlayerManager.selectedVehicle == "FA-26B")
        {
            PlayerManager.selectedVehicle = "F/A-26B";
        }
        VTScenario.current.vehicle      = VTResources.GetPlayerVehicle(PlayerManager.selectedVehicle);
        PilotSaveManager.currentVehicle = VTResources.GetPlayerVehicle(PlayerManager.selectedVehicle);
        VTCampaignInfo[] list   = VTResources.GetBuiltInCampaigns().ToArray();
        string           campID = " ";

        if (PlayerManager.selectedVehicle == "AV-42C")
        {
            campID = "av42cQuickFlight";
        }
        else if (PlayerManager.selectedVehicle == "FA-26B")
        {
            campID = "fa26bFreeFlight";
        }
        else
        {
            campID = "f45-quickFlight";
        }
        Campaign campref = VTResources.GetBuiltInCampaign(campID).ToIngameCampaign();

        PilotSaveManager.currentCampaign = campref;
        Multiplayer._instance.buttonMade = false;
        return(true);
    }
Esempio n. 2
0
    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();
        }
    }