Exemplo n.º 1
0
 void GetComponents()
 {
     m_sceneTransition  = GetComponent <SceneTransition>();
     m_gameLoading      = GetComponent <GameLoading>();
     m_emptyDataHandler = GetComponent <EmptyDataSaving>();
     m_gameSaving       = GetComponent <GameSaving>();
 }
Exemplo n.º 2
0
    private static Vessel LoadVessel(GameSaving.VesselSave vesselToLoad)
    {
        List <Part> list = new List <Part>(GameSaving.LoadParts(vesselToLoad));

        Part[] loadedParts = list.ToArray();
        GameSaving.LoadPartsData(vesselToLoad, loadedParts);
        list.Remove(null);
        Orientation.ApplyOrientation(list[0].transform, list[0].orientation);
        Vessel vessel = Vessel.CreateVessel(list[0].GetComponent <Part>(), Vector2.zero, vesselToLoad.angularVelocity, vesselToLoad.throttle, vesselToLoad.vesselArchivments, Ref.map.mapRefs[Ref.GetPlanetByName(vesselToLoad.adress)].holder);

        for (int i = 0; i < vessel.partsManager.parts.Count; i++)
        {
            if (vessel.partsManager.parts[i] != null)
            {
                vessel.partsManager.parts[i].UpdateConnected();
            }
        }
        vessel.partsManager.UpdateCenterOfMass();
        vessel.partsManager.ReCenter();
        vessel.transform.position    = (vesselToLoad.globalPosition - Ref.positionOffset).toVector2;
        vessel.transform.eulerAngles = new Vector3(0f, 0f, vesselToLoad.rotation);
        if (vesselToLoad.state == Vessel.State.RealTime)
        {
            vessel.partsManager.rb2d.velocity = (vesselToLoad.globalVelocity - Ref.velocityOffset).toVector2;
        }
        else if (vesselToLoad.state == Vessel.State.OnRails || vesselToLoad.state == Vessel.State.OnRailsUnloaded)
        {
            vessel.orbits = Orbit.CalculateOrbits(vesselToLoad.globalPosition, vesselToLoad.globalVelocity, Ref.GetPlanetByName(vesselToLoad.adress));
            vessel.partsManager.rb2d.bodyType = RigidbodyType2D.Static;
            vessel.state = Vessel.State.OnRails;
            if (vessel.state == Vessel.State.OnRailsUnloaded)
            {
                vessel.SetVesselState(Vessel.ToState.ToUnloaded);
            }
            if (double.IsNaN(vessel.orbits[0].meanMotion))
            {
                MonoBehaviour.print("Cannot orbit NaN, went stationary instead");
                vessel.orbits.Clear();
                vessel.stationaryData.posToPlane = vesselToLoad.globalPosition;
                vessel.stationaryData.planet     = Ref.GetPlanetByName(vesselToLoad.adress);
                vessel.state = Vessel.State.Stationary;
                vessel.SetVesselState(Vessel.ToState.ToUnloaded);
                vessel.mapIcon.localPosition = (vessel.stationaryData.posToPlane / 10000.0).toVector3;
            }
        }
        else
        {
            vessel.stationaryData.posToPlane = vesselToLoad.globalPosition;
            vessel.stationaryData.planet     = Ref.GetPlanetByName(vesselToLoad.adress);
            vessel.state = Vessel.State.Stationary;
            if (vesselToLoad.state == Vessel.State.StationaryUnloaded)
            {
                vessel.SetVesselState(Vessel.ToState.ToUnloaded);
            }
            vessel.mapIcon.localPosition = (vessel.stationaryData.posToPlane / 10000.0).toVector3;
        }
        vessel.mapIcon.rotation = vessel.partsManager.parts[0].transform.rotation;
        vessel.RCS = vesselToLoad.RCS;
        return(vessel);
    }
Exemplo n.º 3
0
 public void CompleteLoadProcess()
 {
     Ref.SceneType currentScene = Ref.currentScene;
     if (currentScene != Ref.SceneType.Build)
     {
         if (currentScene == Ref.SceneType.Game)
         {
             GameSaving.Quicksaves quicksaves = GameSaving.Quicksaves.LoadQuicksaves();
             if (this.selectedSaveId != -1 && this.selectedSaveId < quicksaves.QuicksavesCount)
             {
                 GameSaving.LoadGame(quicksaves.quicksaves[this.selectedSaveId]);
                 MsgController.ShowMsg("Game Loaded");
                 this.CloseMenus();
             }
         }
     }
     else
     {
         Build.BuildQuicksaves buildQuicksaves = Build.BuildQuicksaves.LoadBuildQuicksaves();
         if (this.selectedSaveId != -1 && this.selectedSaveId < buildQuicksaves.QuicksavesCount)
         {
             Build.main.LoadSave(buildQuicksaves.buildSaves[this.selectedSaveId]);
             this.CloseMenus();
         }
     }
 }
Exemplo n.º 4
0
    public void GameOver()
    {
        // Debug.Log("sadsad");
        // GameObject[] bg = GameObject.FindGameObjectsWithTag("Background");
        // foreach (GameObject i in bg)
        // {
        //     Debug.Log(i);
        //     i.GetComponent<BackgroundTranform>().enabled = false;
        // }

        // 创建变量,存取数据
        GameSaving gameSaving = new GameSaving();

        // gameSaving.position = new float[3];
        // 在目前的场景中寻找Tag为Player的游戏物体列表,由于Player只有一个,所以列表中第一个就是,所以[0],然后读取这个游戏物体的Component,也就是tranform,并读取里面的position
        //gameSaving.position = GameObject.FindGameObjectsWithTag("Player")[0].transform.position;

        gameSaving.goldnumber = GameObject.Find("GoldText").GetComponent <Text>().text;

        // 讲类转换为Json数据格式
        string jsonData = JsonUtility.ToJson(gameSaving, true);

        // 显示一下到底存在哪里
        Debug.Log(Application.persistentDataPath + "/saveload.json");
        // 讲Json表示的数据写入到硬盘
        File.WriteAllText(Application.persistentDataPath + "/saveload.json", jsonData);

        GameObject.Find("Player").GetComponent <Animator>().enabled = false;
        GameObject.Find("Player").GetComponent <CharacterController2D>().enabled = false;
        this.enabled = false;
        go.SetActive(true);
    }
 private void Construct(SceneTransition sceneTransition,
                        GameSaving gameSaving,
                        GameLoading gameLoading,
                        PauseMenuToggler pauseMenuToggler)
 {
     _sceneTransition  = sceneTransition;
     _gameSaving       = gameSaving;
     _gameLoading      = gameLoading;
     _pauseMenuToggler = pauseMenuToggler;
 }
Exemplo n.º 6
0
    public static void LoadGame(GameSaving.GameSave loadedData)
    {
        GameSaving.ClearScene();
        MySaveLoadedHook mySaveLoadedHook = new MySaveLoadedHook(loadedData);

        mySaveLoadedHook = MyHookSystem.executeHook <MySaveLoadedHook>(mySaveLoadedHook);
        if (mySaveLoadedHook.isCanceled())
        {
            return;
        }

        Ref.planetManager.SwitchLocation(Ref.GetPlanetByName(loadedData.vessels[loadedData.mainVesselId].adress), loadedData.vessels[loadedData.mainVesselId].globalPosition, false, true, 0.0);
        Ref.velocityOffset                 = loadedData.velocityOffset;
        Ref.controller.globalTime          = loadedData.globalTime;
        Ref.controller.timewarpPhase       = loadedData.timeWarpPhase;
        Ref.controller.startedTimewarpTime = loadedData.startedTimewapTime;
        Ref.timeWarping = (Ref.controller.timewarpPhase != 0);
        Ref.controller.SetCameraDistance(loadedData.camDistance);
        foreach (GameSaving.VesselSave vesselToLoad in loadedData.vessels)
        {
            GameSaving.LoadVessel(vesselToLoad);
        }
        Ref.planetManager.FullyLoadTerrain(Ref.GetPlanetByName(loadedData.vessels[loadedData.mainVesselId].adress));
        Ref.mainVessel = Ref.controller.vessels[loadedData.mainVesselId];
        if (loadedData.selectedVesselId != -1)
        {
            Ref.map.SelectVessel(Ref.controller.vessels[loadedData.selectedVesselId], false);
        }
        Ref.map.UpdateVesselsMapIcons();
        Ref.map.following = new OrbitLines.Target(Ref.GetPlanetByName(loadedData.mapFollowingAdress));
        Ref.map.UpdateMapPosition(loadedData.mapPosition);
        Ref.map.UpdateMapZoom(-loadedData.mapPosition.z);
        Ref.map.ToggleMap();
        if (Ref.mapView != loadedData.mapView)
        {
            Ref.map.ToggleMap();
        }
        Ref.mainVessel.SetThrottle(Ref.mainVessel.throttle);
        Ref.map.DrawOrbitLines();
        Ref.controller.RepositionFuelIcons();
        Ref.controller.warpedTimeCounterUI.text = string.Empty;
        Ref.planetManager.UpdateAtmosphereFade();
        Ref.mainVesselHeight        = loadedData.vessels[loadedData.mainVesselId].globalPosition.magnitude2d - Ref.GetPlanetByName(loadedData.vessels[loadedData.mainVesselId].adress).radius;
        Ref.mainVesselAngleToPlanet = (float)Math.Atan2(loadedData.vessels[loadedData.mainVesselId].globalPosition.y, loadedData.vessels[loadedData.mainVesselId].globalPosition.x) * 57.29578f;
        if (Ref.mainVesselHeight < Ref.GetPlanetByName(loadedData.vessels[loadedData.mainVesselId].adress).cameraSwitchHeightM)
        {
            Ref.controller.camTargetAngle = Ref.mainVesselAngleToPlanet - 90f;
        }
        else
        {
            Ref.controller.camTargetAngle = 0f;
        }
        Ref.cam.transform.eulerAngles     = new Vector3(0f, 0f, Ref.controller.camTargetAngle);
        Ref.controller.camAngularVelocity = 0f;
    }
Exemplo n.º 7
0
    void Start()
    {
        // 读取存储在硬盘上的json文件。
        GameSaving gameSaving = JsonUtility.FromJson <GameSaving>(File.ReadAllText(Application.persistentDataPath + "/saveload.json"));

        // 取得里面的数据
        goldnumber2      = GameObject.Find("Text1").GetComponent <Text>();
        goldnumber3      = GameObject.Find("Text2").GetComponent <Text>();
        goldnumber2.text = gameSaving.goldnumber;
        goldnumber3.text = gameSaving.goldnumber;
        Debug.Log(gameSaving.position);
    }
Exemplo n.º 8
0
    public void LoadScores()
    {
        GameSaving data;

        if (File.Exists(Application.persistentDataPath + "/saves.json"))
        {
            data = JsonUtility.FromJson <GameSaving>(File.ReadAllText(Application.persistentDataPath + "/saves.json"));
        }
        else
        {
            data        = new GameSaving();
            data.scores = new [] { 0, 0, 0, 0 };
        }
        scores = data.scores;
    }
Exemplo n.º 9
0
    private static Vessel LoadVessel(GameSaving.VesselSave vesselToLoad)
    {
        Part[] array  = GameSaving.LoadParts(vesselToLoad);
        Vessel vessel = Vessel.CreateVessel(array[0].GetComponent <Part>(), Vector2.zero, vesselToLoad.angularVelocity, vesselToLoad.throttle, vesselToLoad.vesselArchivments, Ref.GetPlanetByName(vesselToLoad.adress).mapRefs.holder);

        vessel.partsManager.UpdateCenterOfMass();
        vessel.partsManager.ReCenter();
        vessel.transform.position    = (vesselToLoad.globalPosition - Ref.positionOffset).toVector2;
        vessel.transform.eulerAngles = new Vector3(0f, 0f, vesselToLoad.rotation);
        if (vesselToLoad.state == Vessel.State.RealTime)
        {
            vessel.partsManager.rb2d.velocity = (vesselToLoad.globalVelocity - Ref.velocityOffset).toVector2;
        }
        else if (vesselToLoad.state == Vessel.State.OnRails || vesselToLoad.state == Vessel.State.OnRailsUnloaded)
        {
            vessel.orbits = Orbit.CalculateOrbits(vesselToLoad.globalPosition, vesselToLoad.globalVelocity, Ref.GetPlanetByName(vesselToLoad.adress));
            vessel.partsManager.rb2d.bodyType = RigidbodyType2D.Static;
            vessel.state = Vessel.State.OnRails;
            if (vessel.state == Vessel.State.OnRailsUnloaded)
            {
                vessel.SetVesselState(Vessel.ToState.ToUnloaded);
            }
            if (double.IsNaN(vessel.orbits[0].meanMotion))
            {
                MonoBehaviour.print("Cannot orbit NaN, went stationary instead");
                vessel.orbits.Clear();
                vessel.stationaryData.posToPlane = vesselToLoad.globalPosition;
                vessel.stationaryData.planet     = Ref.GetPlanetByName(vesselToLoad.adress);
                vessel.state = Vessel.State.Stationary;
                vessel.SetVesselState(Vessel.ToState.ToUnloaded);
                vessel.mapIcon.localPosition = (vessel.stationaryData.posToPlane / 10000.0).toVector3;
            }
        }
        else
        {
            vessel.stationaryData.posToPlane = vesselToLoad.globalPosition;
            vessel.stationaryData.planet     = Ref.GetPlanetByName(vesselToLoad.adress);
            vessel.state = Vessel.State.Stationary;
            if (vesselToLoad.state == Vessel.State.StationaryUnloaded)
            {
                vessel.SetVesselState(Vessel.ToState.ToUnloaded);
            }
            vessel.mapIcon.localPosition = (vessel.stationaryData.posToPlane / 10000.0).toVector3;
        }
        GameSaving.LoadPartsData(vesselToLoad, array);
        vessel.mapIcon.rotation = vessel.partsManager.parts[0].transform.rotation;
        return(vessel);
    }
Exemplo n.º 10
0
 public static void LoadGame(GameSaving.GameSave loadedData)
 {
     GameSaving.ClearScene();
     Ref.planetManager.SwitchLocation(Ref.GetPlanetByName(loadedData.vessels[loadedData.mainVesselId].adress), loadedData.vessels[loadedData.mainVesselId].globalPosition, false, true);
     Ref.velocityOffset                 = loadedData.velocityOffset;
     Ref.controller.globalTime          = loadedData.globalTime;
     Ref.controller.timewarpPhase       = loadedData.timeWarpPhase;
     Ref.controller.startedTimewarpTime = loadedData.startedTimewapTime;
     Ref.timeWarping = (Ref.controller.timewarpPhase != 0);
     Ref.controller.SetCameraDistance(loadedData.camDistance);
     foreach (GameSaving.VesselSave current in loadedData.vessels)
     {
         GameSaving.LoadVessel(current);
     }
     Ref.planetManager.FullyLoadTerrain(Ref.GetPlanetByName(loadedData.vessels[loadedData.mainVesselId].adress));
     Ref.mainVessel     = Ref.controller.vessels[loadedData.mainVesselId];
     Ref.selectedVessel = ((loadedData.selectedVesselId == -1) ? null : Ref.controller.vessels[loadedData.selectedVesselId]);
     Ref.map.UpdateVesselsMapIcons();
     Ref.map.following = Ref.GetPlanetByName(loadedData.mapFollowingAdress);
     Ref.map.UpdateMapPosition(loadedData.mapPosition);
     Ref.map.UpdateMapZoom(-loadedData.mapPosition.z);
     Ref.map.ToggleMap();
     if (Ref.mapView != loadedData.mapView)
     {
         Ref.map.ToggleMap();
     }
     Ref.mainVessel.SetThrottle(Ref.mainVessel.throttle);
     Ref.map.UpdateVesselOrbitLines(new List <Orbit>(), true);
     Ref.controller.RepositionFuelIcons();
     Ref.controller.warpedTimeCounterUI.text = string.Empty;
     if (Ref.map.transferWindow.target != null)
     {
         Ref.map.SelectCelestilaBodyTarget(Ref.map.transferWindow.target);
     }
     Ref.planetManager.UpdateAtmosphereFade();
     Ref.mainVesselHeight        = loadedData.vessels[loadedData.mainVesselId].globalPosition.magnitude2d - Ref.GetPlanetByName(loadedData.vessels[loadedData.mainVesselId].adress).radius;
     Ref.mainVesselAngleToPlanet = (float)Math.Atan2(loadedData.vessels[loadedData.mainVesselId].globalPosition.y, loadedData.vessels[loadedData.mainVesselId].globalPosition.x) * 57.29578f;
     if (Ref.mainVesselHeight < Ref.GetPlanetByName(loadedData.vessels[loadedData.mainVesselId].adress).cameraSwitchHeightM)
     {
         Ref.controller.camTargetAngle = Ref.mainVesselAngleToPlanet - 90f;
     }
     else
     {
         Ref.controller.camTargetAngle = 0f;
     }
     Ref.cam.transform.eulerAngles     = new Vector3(0f, 0f, Ref.controller.camTargetAngle);
     Ref.controller.camAngularVelocity = 0f;
 }
Exemplo n.º 11
0
 public static void LoadForLaunch(GameSaving.GameSave loadedData, Double3 launchPadPosition)
 {
     for (int i = 0; i < loadedData.vessels.Count; i++)
     {
         if (loadedData.vessels[i].adress == Ref.controller.startAdress && Math.Abs(loadedData.vessels[i].globalPosition.x - launchPadPosition.x) < 10.0 && Math.Abs(loadedData.vessels[i].globalPosition.y - launchPadPosition.y) < 40.0)
         {
             loadedData.vessels.RemoveAt(i);
             i--;
         }
         else
         {
             Vessel.State state = loadedData.vessels[i].state;
             if (state != Vessel.State.RealTime)
             {
                 if (state != Vessel.State.OnRails)
                 {
                     if (state == Vessel.State.Stationary)
                     {
                         loadedData.vessels[i].state = Vessel.State.StationaryUnloaded;
                     }
                 }
                 else
                 {
                     loadedData.vessels[i].state = Vessel.State.OnRailsUnloaded;
                 }
             }
             else if ((loadedData.vessels[i].globalPosition - launchPadPosition).magnitude2d > 1000.0 || loadedData.vessels[i].adress != Ref.controller.startAdress)
             {
                 loadedData.vessels[i].state = ((Math.Abs(loadedData.vessels[i].globalVelocity.x) <= 1.0 && Math.Abs(loadedData.vessels[i].globalVelocity.y) <= 1.0) ? Vessel.State.StationaryUnloaded : Vessel.State.OnRailsUnloaded);
             }
         }
     }
     Ref.planetManager.SwitchLocation(Ref.GetPlanetByName(Ref.controller.startAdress), launchPadPosition, false, true, 0.0);
     Ref.planetManager.UpdatePositionOffset(new Double3(0.0, 315000.0));
     Ref.velocityOffset           = Double3.zero;
     Ref.controller.globalTime    = loadedData.globalTime;
     Ref.controller.timewarpPhase = 0;
     Ref.timeWarping = false;
     foreach (GameSaving.VesselSave vesselToLoad in loadedData.vessels)
     {
         GameSaving.LoadVessel(vesselToLoad);
     }
     Ref.map.following = new OrbitLines.Target(Ref.GetPlanetByName(Ref.controller.startAdress));
     Ref.map.UpdateMapPosition(new Double3(0.0, launchPadPosition.y / 10000.0));
     Ref.map.UpdateMapZoom(launchPadPosition.y / 10000.0 / 20.0);
     Ref.planetManager.UpdateAtmosphereFade();
     Ref.controller.warpedTimeCounterUI.text = string.Empty;
 }
Exemplo n.º 12
0
    public void CompleteSaveProcess()
    {
        string text = TouchKeyboard.main.GetText("Unnamed Save");

        Ref.SceneType currentScene = Ref.currentScene;
        if (currentScene != Ref.SceneType.Build)
        {
            if (currentScene == Ref.SceneType.Game)
            {
                GameSaving.Quicksaves.AddQuicksave(GameSaving.GetGameSaveData(text));
                MsgController.ShowMsg("Game Saved");
            }
        }
        else
        {
            Build.BuildQuicksaves.AddQuicksave(new Build.BuildSave(text, Camera.main.transform.position, Build.main.buildGrid.parts, 0));
            MsgController.ShowMsg("Design Saved");
        }
        this.onCloseSaveMenu.InvokeEvenets();
        this.CloseMenus();
        this.UpdateLoadButtonColor();
    }
Exemplo n.º 13
0
    public void Save(int score, int levelIndex)
    {
        GameSaving data;

        if (File.Exists(Application.persistentDataPath + "/saves.json"))
        {
            data = JsonUtility.FromJson <GameSaving>(File.ReadAllText(Application.persistentDataPath + "/saves.json"));
        }
        else
        {
            data        = new GameSaving();
            data.scores = new [] { 0, 0, 0, 0 };
        }

        if (score > data.scores[levelIndex])
        {
            data.scores[levelIndex] = score;
            string jsonData = JsonUtility.ToJson(data, true);
            File.WriteAllText(Application.persistentDataPath + "/saves.json", jsonData);
        }

        Menu.GetComponent <MenuScript>().ReloadScores(Math.Max(score, data.scores[levelIndex]), levelIndex);
    }
Exemplo n.º 14
0
    private void IniciateGameScene()
    {
        this.updatedPersistantTime = Time.time + 10f;
        CelestialBodyData planetByName = Ref.GetPlanetByName(this.startAdress);
        Double3           @double      = new Double3(-450.0, planetByName.radius + 30.0);

        Ref.map.InitializeMap();
        this.cheatEnabledText.text = ((!Ref.infiniteFuel) ? string.Empty : "\n Infinite Fuel: On") + ((!Ref.noDrag) ? string.Empty : "\n No Drag: On") + ((!Ref.unbreakableParts) ? string.Empty : "\n Unbreakable Parts: On") + ((!Ref.noGravity) ? string.Empty : "\n No Gravity: On");
        GameSaving.GameSave gameSave = GameSaving.GameSave.LoadPersistant();
        if (Ref.lastScene == Ref.SceneType.Build)
        {
            if (gameSave != null && gameSave.vessels.Count > 0)
            {
                gameSave.velocityOffset   = Double3.zero;
                gameSave.selectedVesselId = -1;
                GameSaving.LoadForLaunch(gameSave, @double);
                MonoBehaviour.print("There is a Persistant-Save, and a Rocket To Create");
            }
            else
            {
                MonoBehaviour.print("There is No Persistant-Save, created rocket into new scene empty scene");
                Ref.planetManager.SwitchLocation(planetByName, @double, false, true, 0.0);
                Ref.map.following = new OrbitLines.Target(planetByName);
                Ref.map.UpdateMapPosition(new Double3(0.0, @double.y / 10000.0));
                Ref.map.UpdateMapZoom(@double.y / 10000.0 / 20.0);
            }
            this.CreatePartsFromBuild(@double);
            Ref.mainVessel.SetThrottle(new Vessel.Throttle(false, 0.65f));
            Ref.mapView = false;
            Ref.controller.SetCameraDistance(23f);
        }
        else if (gameSave != null)
        {
            GameSaving.LoadGame(gameSave);
            MonoBehaviour.print("No rocket to create, loaded persistant");
        }
    }
Exemplo n.º 15
0
    public void CompleteSaveProcess()
    {
        string text = this.keyboardText.text.Replace("|", string.Empty);

        if (text == string.Empty)
        {
            text = "Unnamed Save";
        }
        Ref.SceneType currentScene = Ref.currentScene;
        if (currentScene != Ref.SceneType.Build)
        {
            if (currentScene == Ref.SceneType.Game)
            {
                GameSaving.Quicksaves.AddQuicksave(GameSaving.GetGameSaveData(text));
                Ref.controller.ShowMsg("Game Saved");
            }
        }
        else
        {
            Build.BuildQuicksaves.AddQuicksave(new Build.BuildSave(text, Camera.main.transform.position, Build.main.buildGrid.parts));
        }
        this.CloseMenus();
        this.UpdateLoadButtonColor();
    }
Exemplo n.º 16
0
 public override void OnSaveData()
 {
     // TODO: investigate the exception on overwriting an existing game file
     GameSaving?.Invoke(this, EventArgs.Empty);
 }
 private void Construct(GameSaving gameSaver)
 {
     _gameSaving = gameSaver;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Called when the level is being saved.
 /// </summary>
 public override void OnSaveData()
 {
     GameSaving?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 19
0
 public static void UpdatePersistantSave()
 {
     GameSaving.GameSave gameSaveData = GameSaving.GetGameSaveData("Persistant Game Save");
     Ref.SaveJsonString(JsonUtility.ToJson(gameSaveData), Saving.SaveKey.PersistantGameSave);
 }
Exemplo n.º 20
0
 public static GameSaving.GameSave GetGameSaveData(string saveName)
 {
     return(new GameSaving.GameSave(saveName, GameSaving.GetVesselListIndex(Ref.mainVessel), GameSaving.GetVesselListIndex(Ref.selectedVessel), GameSaving.GetVesselSaveData(Ref.controller.vessels), Ref.positionOffset, Ref.velocityOffset, Ref.controller.globalTime, Ref.controller.timewarpPhase, Ref.controller.startedTimewarpTime, Ref.controller.cameraDistanceGame, Ref.mapView, Ref.map.mapPosition, Ref.map.following.GetFollowingBody().bodyName));
 }
Exemplo n.º 21
0
    private static List <GameSaving.VesselSave> GetVesselSaveData(List <Vessel> vesselsToSave)
    {
        List <GameSaving.VesselSave> list = new List <GameSaving.VesselSave>();

        for (int i = 0; i < vesselsToSave.Count; i++)
        {
            list.Add(new GameSaving.VesselSave(vesselsToSave[i].state, vesselsToSave[i].GetVesselPlanet.bodyName, vesselsToSave[i].GetGlobalPosition, vesselsToSave[i].GetGlobalVelocity, vesselsToSave[i].partsManager.rb2d.rotation, vesselsToSave[i].partsManager.rb2d.angularVelocity, vesselsToSave[i].throttle, GameSaving.GetPartsSaveData(vesselsToSave[i].partsManager.parts), GameSaving.GetPartsJointsSave(vesselsToSave[i].partsManager.parts), vesselsToSave[i].vesselAchievements, vesselsToSave[i].RCS));
        }
        return(list);
    }