Beispiel #1
0
        public void ReloadGameSaves()
        {
            CharSelectPreview preview;
            // Check to see if the previous player chose new game, if so, make a new "New Game" slot with an incremented file name
            CharSelectPlayer previousPlayer = players.ElementAt(currentPlayerIndex - 1);

            if (previousPlayer.gameSave.newGame)
            {
                preview            = new CharSelectPreview(game.Content.Load <Texture2D>("Spritesheets/charSelectNewGame"), gameSavePosition, spriteFont, "New Game", " ", selected, "");
                preview.fileNumber = previousPlayer.gameSave.fileNumber + 1;
                preview.fileName   = "charSave" + preview.fileNumber;
                gameSaves.Insert(0, preview);
            }

            // Reload the game saves
            for (int i = 0; i < gameSaves.Count; i++)
            {
                preview = gameSaves.ElementAt(i);
                preview.SetPosition(gameSavePosition + (movementOffset * i));
                if (i == 0)
                {
                    preview.Color = selected;
                }
                else
                {
                    preview.Color = unselected;
                }
            }

            selectedGameSave = 0;
        }
Beispiel #2
0
        public DungeonCrawlerGame.CharacterSaveFile LoadGameSave(CharSelectPreview preview)
        {
            IAsyncResult  result = StorageDevice.BeginShowSelector(PlayerIndex.One, null, null);
            StorageDevice device = StorageDevice.EndShowSelector(result);

            if (device != null && device.IsConnected)
            {
                return(DungeonCrawlerGame.DoLoadGame(device, preview.fileName));
            }
            return(new DungeonCrawlerGame.CharacterSaveFile());
        }
Beispiel #3
0
        public CharSelectPreview LoadPreview(DungeonCrawlerGame.CharacterSaveFilePreview saveFilePreview)
        {
            CharSelectPreview charSelectPreview;
            Texture2D         charSprite   = game.Content.Load <Texture2D>(saveFilePreview.charSprite);
            string            charSaveFile = saveFilePreview.CharacterSaveFile;
            string            charType     = saveFilePreview.characterType;
            string            level        = "Level: " + saveFilePreview.Level.ToString();
            Vector2           position     = gameSavePosition + (movementOffset * gameSaves.Count);

            charSelectPreview = new CharSelectPreview(charSprite, position, spriteFont, charType, level, unselected, charSaveFile);
            return(charSelectPreview);
        }
Beispiel #4
0
        public void loadGameSaves()
        {
            // Create the "New Game" slot
            CharSelectPreview charPreview = new CharSelectPreview(game.Content.Load <Texture2D>("Spritesheets/charSelectNewGame"), gameSavePosition, spriteFont, "New Game", " ", selected, "");

            gameSaves.Add(charPreview);

            IAsyncResult  result = StorageDevice.BeginShowSelector(PlayerIndex.One, null, null);
            StorageDevice device = StorageDevice.EndShowSelector(result);

            DungeonCrawlerGame.MasterSaveFile masterSaveFile;
            List <DungeonCrawlerGame.CharacterSaveFilePreview> listCSF = new List <DungeonCrawlerGame.CharacterSaveFilePreview>();

            if (device != null && device.IsConnected)
            {
                masterSaveFile = DungeonCrawlerGame.GetMasterSaveFile(device);
                if (masterSaveFile.charFiles == null)
                {
                    charPreview.fileNumber = 1;
                    charPreview.fileName   = "CharSave1";
                }
                else
                {
                    charPreview.fileNumber = masterSaveFile.charFiles.Count + 1;
                    charPreview.fileName   = "charSave" + charPreview.fileNumber;
                    //masterSaveFile.charFiles.Clear();
                    //DungeonCrawlerGame.SaveMasterFile(device, masterSaveFile);

                    foreach (DungeonCrawlerGame.CharacterSaveFilePreview csf in masterSaveFile.charFiles)
                    {
                        if (csf.charSprite == "" || csf.charSprite == null)
                        {
                            masterSaveFile.charFiles.Remove(csf);
                            DungeonCrawlerGame.SaveMasterFile(device, masterSaveFile);
                            break;
                        }
                        else
                        {
                            charPreview = LoadPreview(csf);
                            gameSaves.Add(charPreview);
                        }
                    }
                }
            }
        }
        public void ReloadGameSaves()
        {
            CharSelectPreview preview;
            // Check to see if the previous player chose new game, if so, make a new "New Game" slot with an incremented file name
            CharSelectPlayer previousPlayer = players.ElementAt(currentPlayerIndex - 1);
            if (previousPlayer.GameSave.NewGame)
            {
                preview = new CharSelectPreview(game.Content.Load<Texture2D>("Spritesheets/CharSelect/charSelectNewGame"), gameSavePosition, spriteFont, "New Game", " ", selected, "");
                preview.FileNumber = previousPlayer.GameSave.FileNumber + 1;
                preview.FileName = "charSave" + preview.FileNumber;
                gameSaves.Insert(0, preview);
            }

            // Reload the game saves
            for (int i = 0; i < gameSaves.Count; i++)
            {
                preview = gameSaves.ElementAt(i);
                preview.SetPosition(gameSavePosition + (movementOffset * i));
                if (i == 0)
                    preview.Color = selected;
                else
                    preview.Color = unselected;
            }

            selectedGameSave = 0;
        }
 public CharSelectPreview LoadPreview(DungeonCrawlerGame.CharacterSaveFilePreview saveFilePreview)
 {
     CharSelectPreview charSelectPreview;
     Texture2D charSprite = game.Content.Load<Texture2D>(saveFilePreview.charSprite);
     string charSaveFile = saveFilePreview.CharacterSaveFile;
     string charType = saveFilePreview.characterType;
     string level = "Level: " + saveFilePreview.Level.ToString();
     Vector2 position = gameSavePosition + (movementOffset * gameSaves.Count);
     charSelectPreview = new CharSelectPreview(charSprite, position, spriteFont, charType, level, unselected, charSaveFile);
     return charSelectPreview;
 }
        public void loadGameSaves()
        {
            // Create the "New Game" slot
            CharSelectPreview charPreview = new CharSelectPreview(game.Content.Load<Texture2D>("Spritesheets/CharSelect/charSelectNewGame"), gameSavePosition, spriteFont, "New Game", " ", selected, "");
            gameSaves.Add(charPreview);

            IAsyncResult result = StorageDevice.BeginShowSelector(PlayerIndex.One, null, null);
            StorageDevice device = StorageDevice.EndShowSelector(result);

            DungeonCrawlerGame.MasterSaveFile masterSaveFile;
            List<DungeonCrawlerGame.CharacterSaveFilePreview> listCSF = new List<DungeonCrawlerGame.CharacterSaveFilePreview>();

            if (device != null && device.IsConnected)
            {
                masterSaveFile = DungeonCrawlerGame.GetMasterSaveFile(device);
                if (masterSaveFile.charFiles == null)
                {
                    charPreview.FileNumber = 1;
                    charPreview.FileName = "CharSave1";
                }
                else
                {
                    charPreview.FileNumber = masterSaveFile.charFiles.Count + 1;
                    charPreview.FileName = "charSave" + charPreview.FileNumber;
                    //masterSaveFile.charFiles.Clear();
                    //DungeonCrawlerGame.SaveMasterFile(device, masterSaveFile);

                    foreach (DungeonCrawlerGame.CharacterSaveFilePreview csf in masterSaveFile.charFiles)
                    {
                        if (csf.charSprite == "" || csf.charSprite == null)
                        {
                            masterSaveFile.charFiles.Remove(csf);
                            DungeonCrawlerGame.SaveMasterFile(device, masterSaveFile);
                            break;
                        }
                        else
                        {
                            charPreview = LoadPreview(csf);
                            gameSaves.Add(charPreview);
                        }
                    }
                }
            }
        }
        public DungeonCrawlerGame.CharacterSaveFile LoadGameSave(CharSelectPreview preview)
        {
            IAsyncResult result = StorageDevice.BeginShowSelector(PlayerIndex.One, null, null);
            StorageDevice device = StorageDevice.EndShowSelector(result);

            if (device != null && device.IsConnected)
            {
                return DungeonCrawlerGame.DoLoadGame(device, preview.FileName);
            }
            return new DungeonCrawlerGame.CharacterSaveFile();
        }