Beispiel #1
0
        private void OpenGame(string path)
        {
            gamePath  = Path.Combine(path, "Game");
            classPath = Path.Combine(gamePath, "Classes");
            itemPath  = Path.Combine(gamePath, "Items");
            keyPath   = Path.Combine(gamePath, "Keys");
            chestPath = Path.Combine(gamePath, "Chests");
            skillPath = Path.Combine(gamePath, "Skills");

            if (!Directory.Exists(keyPath))
            {
                Directory.CreateDirectory(keyPath);
            }

            if (!Directory.Exists(chestPath))
            {
                Directory.CreateDirectory(chestPath);
            }

            if (!Directory.Exists(skillPath))
            {
                Directory.CreateDirectory(skillPath);
            }

            rolePlayingGame = XnaSerializer.Deserialize <RolePlayingGame>(
                gamePath + @"\Game.xml");

            FormDetails.ReadEntityData();
            FormDetails.ReadItemData();
            FormDetails.ReadKeyData();
            FormDetails.ReadChestData();
            FormDetails.ReadSkillData();

            PrepareForms();
        }
        private void OpenGame(string path)
        {
            gamePath  = Path.Combine(path, "Game");
            classPath = Path.Combine(gamePath, "Classes");
            itemPath  = Path.Combine(gamePath, "Items");

            rolePlayingGame = XnaSerializer.Deserialize <RolePlayingGame>(
                gamePath + @"\Game.xml");

            FormDetails.ReadEntityData();
            FormDetails.ReadItemData();

            PrepareForms();
        }
        void saveGameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (rolePlayingGame != null)
            {
                try
                {
                    XnaSerializer.Serialize <RolePlayingGame>(gamePath + @"\Game.xml", rolePlayingGame);

                    FormDetails.WriteEntityData();
                    FormDetails.WriteItemData();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Error saving game.");
                }
            }
        }
Beispiel #4
0
        private void OpenGame(string path)
        {
            gamePath  = path;
            classPath = Path.Combine(gamePath, "Classes");
            itemPath  = Path.Combine(gamePath, "Items");
            keyPath   = Path.Combine(gamePath, "Keys");
            chestPath = Path.Combine(gamePath, "Chests");
            skillPath = Path.Combine(gamePath, "Skills");

            rolePlayingGame = XNASerializer.Deserialize <RolePlayingGame>(gamePath + "\\Game.xml");

            FormDetails.ReadEntityData();
            FormDetails.ReadItemData();
            FormDetails.ReadKeyData();
            FormDetails.ReadChestData();
            FormDetails.ReadSkillData();

            PrepareForms();
        }