Beispiel #1
0
    public static void Load(string saveName)
    {
        if (!File.Exists(saveName + ".txt"))
        {
            return;
        }

        //Czyszczenie układu z planet
        while (PlanetData.Planets.Count != 0)
        {
            PlanetManager.Destroy(PlanetData.Planets[0]);
        }

        using (StreamReader sr = new StreamReader(saveName + ".txt"))
        {
            while (!sr.EndOfStream)
            {
                IMovingPlanet planet = PlanetManager.Create();
                planet.PlanetName  = sr.ReadLine();
                planet.Size        = float.Parse(sr.ReadLine());
                planet.Mass        = float.Parse(sr.ReadLine());
                planet.Speed       = float.Parse(sr.ReadLine());
                planet.SunDistance = float.Parse(sr.ReadLine());
                planet.Material    = sr.ReadLine();
            }
        }

        Factory.GetUIController().RefreshSelectPlanetDropdown();
    }
Beispiel #2
0
    /// <summary>
    /// Dodawanie planety do układu słonecznego
    /// </summary>
    private void AddPlanetButtonClick()
    {
        IMovingPlanet planet = (Planet)PlanetManager.Create();

        CameraFocus.OnPlanet(planet, true);
    }