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();
    }
Exemple #2
0
 public static bool Prefix(ref CampaignSave __result, string campaignID)
 {
     if (!(VTOLAPI.currentScene == VTOLScenes.VehicleConfiguration) || AEAT.trueSave == null)
     {
         //Debug.Log("Not spoofing this save.");
         return(true);
     }
     Debug.Log(AEAT.trueSave.campaignID + " will be used as a campaign save.");
     __result = AEAT.trueSave;
     if (!AEAT.buttonMade)
     {
         Debug.Log(AEAT.path + " is AEAT.path");
         VTOLAPI.GetPlayersVehicleGameObject().GetComponentInChildren <WeaponManager>().resourcePath = "hpequips/" + AEAT.path;
         LoadoutConfigurator config = Resources.FindObjectsOfTypeAll <LoadoutConfigurator>()[0];
         config.wm.resourcePath = VTOLAPI.GetPlayersVehicleGameObject().GetComponentInChildren <WeaponManager>().resourcePath;
         PilotSaveManager.currentVehicle.equipsResourcePath = "hpequips/" + AEAT.path;
         List <string> marsh      = new List <string>();
         List <GameObject> ketkev = new List <GameObject>();
         foreach (var gameobject in Resources.LoadAll <GameObject>("hpequips/" + AEAT.path))
         {
             if (!AllowedEquips.allowedEquips.Contains(gameobject.name))
             {
                 //Debug.Log("Unauthorized gameobject " + gameobject.name);
                 continue;
             }
             marsh.Add(gameobject.name);
             ketkev.Add(gameobject);
         }
         Traverse.Create(config).Field("unlockedWeaponPrefabs").SetValue(new Dictionary <string, EqInfo>());
         Traverse.Create(config).Field("allWeaponPrefabs").SetValue(new Dictionary <string, EqInfo>());
         config.lockedHardpoints = new List <int>();
         VTResources.GetScenario(PilotSaveManager.currentScenario.scenarioID, PilotSaveManager.currentCampaign).allowedEquips = marsh;
         __result.availableWeapons = marsh;
         Debug.Log("Set allowedEquips.");
         PilotSaveManager.currentVehicle.allEquipPrefabs = ketkev; // Don't need to reinit the config because this is prefixing the init statement
     }
     return(false);
 }
Exemple #3
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();
        }
    }