Exemplo n.º 1
0
        public static Savegame Load(Hansel pHansel, Gretel pGretel)         //Muss static sein damit das Savegame als solches gesetzt werden kann.
        {
            Savegame TmpSavegame;
            FileInfo file = new FileInfo(Savegame.SavegamePath);

            if (!file.Exists)
            {
                //Build Default Savegame
                TmpSavegame = new Savegame();
                TmpSavegame.Reset();
                CopyPlayerPositions(pHansel, pGretel, TmpSavegame);
                //Save new Savegame to File
                Savegame.Save(TmpSavegame, pHansel, pGretel);
                //Setup Savegame
                TmpSavegame.LoadContent();
                TmpSavegame.Scenes[TmpSavegame.SceneId].SetupRenderList(pHansel, pGretel);
                return(TmpSavegame);
            }
            //Get Savegame from File
            xmlReader   = new StreamReader(Savegame.SavegamePath);
            TmpSavegame = (Savegame)SavegameSerializer.Deserialize(xmlReader);             //Savegame aus File laden
            xmlReader.Close();
            //SetupSavegame
            CopyPlayerPositions(pHansel, pGretel, TmpSavegame);
            TmpSavegame.LoadContent();
            TmpSavegame.Scenes[TmpSavegame.SceneId].SetupRenderList(pHansel, pGretel);
            return(TmpSavegame);
        }
Exemplo n.º 2
0
        public static Savegame Load()         //Muss static sein damit das Savegame als solches gesetzt werden kann.
        {
            Savegame TmpSavegame;
            FileInfo file = new FileInfo(Savegame.SavegamePath);

            if (!file.Exists)
            {
                TmpSavegame = new Savegame();
                TmpSavegame.Reset();
                Savegame.Save(TmpSavegame);
                return(TmpSavegame);
            }
            xmlReader   = new StreamReader(Savegame.SavegamePath);
            TmpSavegame = (Savegame)SavegameSerializer.Deserialize(xmlReader);             //Savegame aus File laden
            xmlReader.Close();

            return(TmpSavegame);
        }
Exemplo n.º 3
0
		public static Savegame Load() //Muss static sein damit das Savegame als solches gesetzt werden kann.
		{
			Savegame TmpSavegame;
			FileInfo file = new FileInfo(Savegame.SavegamePath);
			if (!file.Exists)
			{
				TmpSavegame = new Savegame();
				TmpSavegame.Reset();
				Savegame.Save(TmpSavegame);
				return TmpSavegame;
			}
			xmlReader = new StreamReader(Savegame.SavegamePath);
			TmpSavegame = (Savegame)SavegameSerializer.Deserialize(xmlReader); //Savegame aus File laden
			xmlReader.Close();
			
			return TmpSavegame;
		}