Beispiel #1
0
        public static void Main()
        {
            // Uncomment to clear settings if testing or something has broken things.

            //UserDataManager.DeleteSaveSummaryFile();
            //UserData.ApplicationSettings.ClearAllParameters();

            StaticDatabase.StaticDatabaseConnection.OpenDBConnection();
            UserDataManager.SetupDirectoriesAndFiles();

            UserInputHandler.ExtraKeys  = UserData.ApplicationSettings.ExtraKeys;
            UserDataManager.FullLogging = UserData.ApplicationSettings.FullLogging;
            // TODO: Set the gm option here too.

            rootConsole = new RLRootConsole(_fontName, _consoleWidth, _consoleHeight, _fontSize, _fontSize, _scale,
                                            _windowTitle);

            rootConsole.Update += RootConsoleUpdate;
            rootConsole.Render += RootConsoleRender;

            var mainLoopThread = new Thread(RunStartMenu);

            mainLoopThread.Start();
            rootConsole.Run();
            StaticDatabase.StaticDatabaseConnection.CloseDBConnection();
        }
Beispiel #2
0
        static void RunStartMenu()
        {
            var gameId = MenuProvider.MainMenu.DisplayMainMenu();

            if (gameId == -1)
            {
                Quit();
                return;
            }

            var gameState = UserDataManager.GetGameState(gameId);

            if (gameState.Summary.CurrentLevelName == "NEWGAME")
            {
                SetupNewGame(gameState.Summary.GameData);
                Quests.GameEventManager.SetupGameEventHandling();
                LevelTransition(_startingLevel, _startingXLoc, _startingYLoc);
            }
            else
            {
                LoadGame(gameState);
                // Have to complete the player's turn and increment timer.
                Entities.Player.Player.UpdatePlayer(_currentLevel);
                _currentTime++;
            }

            RunGame();
            Quit();
        }
Beispiel #3
0
        public static void SaveGame()
        {
            var summary       = new UserData.SaveGameSummary(_gameData, _currentLevel.LevelName);
            var saveGameState = new UserData.SaveGame(summary);

            saveGameState.CurrentTime = _currentTime;
            saveGameState.Player      = _player;

            saveGameState.CurrentLevelId = _currentLevel.LevelId;
            foreach (KeyValuePair <Levels.LevelId, Levels.Level> level in _levels)
            {
                saveGameState.Levels[level.Key] = level.Value.GetSaveDetails();
            }

            saveGameState.Furnishings = Entities.Furnishings.Furnishing.GetSaveData();
            saveGameState.Monsters    = Entities.Monsters.Monster.GetSaveData();

            Quests.GameEventManager.SaveData(saveGameState);

            saveGameState.TopLevelRNG = _topLevelRNG.GetSaveData();
            saveGameState.CombatRNG   = _combatRNG.GetSaveData();
            saveGameState.LootRNG     = _lootRNG.GetSaveData();
            saveGameState.MiscRNG     = _miscRNG.GetSaveData();

            UserDataManager.SaveGame(saveGameState);
        }
        public void TestCharacterSelectionNew()
        {
            for (int i = 1; i < 4; i++)
            {
                var summary = new SaveGameSummary(new GameData(i, "Test" + i.ToString()), "TestLevel1");
                ApplicationSettings.AddSaveGame(i);
                UserDataManager.WriteSaveGameSummary(summary);
            }

            var keyList = new List <string> {
                "4"
            };

            UserInputHandler.AddKeyboardInput(keyList);
            var characterSelectionMenu = new CharacterSelectionMenu();

            Assert.AreEqual(-2, characterSelectionMenu.SelectCharacterToPlay());
        }
 public void RemoveFiles()
 {
     UserDataManager.SetTestHomeDirectory(_testFilePath);
     ApplicationSettings.ClearAllParameters();
     UserDataManager.DeleteSaveSummaryFile();
 }