public InteractiveDialoguePane(Screen screen, UIAlignment alignment, int x, int y, int width, int height, SpriteFont dialogueFont, SpriteFont optionFont, CharacterDialogueComponent dialogueComponent)
     : base(screen, alignment, x, y, width, height)
 {
     _dialogueComponent = dialogueComponent;
     _dialogueFont = dialogueFont;
     _optionFont = optionFont;
     _dialogueManager = DataManager.dialogueManager;
     _maxLineWidth = (float)_width - _margin * 2f;
     _optionButtons = new List<TextButton>();
     setCurrentNodeUid(_dialogueManager.getCurrentDialogueNodeUid(dialogueComponent.dialogueUid));
 }
예제 #2
0
        // Create new player data
        public static int createPlayerData(string playerName, bool saveData = true)
        {
            Logger.log("DataManager.createPlayerData method starting.");

            int unusedPlayerSlot = 0;
            bool created = false;

            while (!created)
            {
                if (File.Exists(_playersDirectory + string.Format("player_data_{0}.xml", unusedPlayerSlot)))
                    unusedPlayerSlot++;
                else
                {
                    WorldMapState startingWorldMapState;

                    _playerName = playerName;
                    _playerSlot = unusedPlayerSlot;

                    // Create managers
                    _worldMapManager = createWorldMapManager();
                    _itemManager = createItemManager();
                    _dialogueManager = new DialogueManager(_systemManager, _entityManager);
                    _questManager = new QuestManager();

                    // Create starting world map states
                    startingWorldMapState = new WorldMapState(_worldMapManager.getWorldMapDefinition("oria_world_map"), true);
                    startingWorldMapState.levelIconStates.Add(
                        new LevelIconState(
                            _worldMapManager.getLevelIconDefinition("oria_world_map", "home_village"),
                            true,
                            true));
                    _worldMapManager.worldMapStates.Add(
                        "oria_world_map",
                        startingWorldMapState);

                    // Create inventory and toolbar
                    _entityManager.addComponent("global", PlayerSystem.PLAYER_ID, new InventoryComponent(32));
                    _entityManager.addComponent("global", PlayerSystem.PLAYER_ID, new ToolbarComponent(4, PlayerSystem.PLAYER_ID));

                    if (saveData)
                    {
                        savePlayerData();
                    }
                    created = true;
                }
            }

            Logger.log("DataManager.createPlayerData method finished.");

            return unusedPlayerSlot;
        }
예제 #3
0
        // Load player data
        public static void loadPlayerData(int playerSlot)
        {
            Logger.log("DataManager.loadPlayerData method starting.");

            string filePath = _playersDirectory + string.Format("player_data_{0}.xml", playerSlot);

            using (FileStream fs = new FileStream(filePath, FileMode.Open))
            {
                XDocument doc = XDocument.Load(fs);

                // Basic player data
                _playerData = doc.Element("PlayerData");
                _playerSlot = playerSlot;
                _playerName = _playerData.Attribute("name").Value;

                // Create managers
                _worldMapManager = createWorldMapManager();
                _questManager = new QuestManager();
                _itemManager = createItemManager();
                _dialogueManager = new DialogueManager(_systemManager, _entityManager);

                // World map states
                _worldMapManager.worldMapStates = loadWorldMapStates(new List<XElement>(_playerData.Elements("WorldMapState")));

                // Inventory and toolbar
                loadPlayerInventory();
                loadPlayerToolbar();

                // Custom flags and values
                loadCustomFlags();
                loadCustomValues();
            }

            Logger.log("DataManager.loadPlayerData method finished.");
        }