Exemple #1
0
        public FormDetails()
        {
            InitializeComponent();

            if (FormDetails.itemManager == null)
                itemManager = new ItemDataManager();

            if (FormDetails.entityDataManager == null)
                entityDataManager = new EntityDataManager();

            if (FormDetails.skillManager == null)
                skillManager = new SkillDataManager();

            this.FormClosing += new FormClosingEventHandler(FormDetails_FormClosing);
        }
        public FormDetails()
        {
            InitializeComponent();

            if (FormDetails.entityDataManager == null)
            {
                entityDataManager = new EntityDataManager();
            }

            if (FormDetails.itemDataManager == null)
            {
                itemDataManager = new ItemDataManager();
            }

            this.FormClosing += new FormClosingEventHandler(DetailsForm_Close);
        }
        public static void ReadItemData()
        {
            if (Directory.Exists(FormMain.itemPath))
            {
                itemDataManager = new ItemDataManager();

                string[] weaponNames = Directory.GetFiles(Path.Combine(FormMain.itemPath, "Weapon"));
                string[] armorNames = Directory.GetFiles(Path.Combine(FormMain.itemPath, "Armor"));
                string[] shieldNames = Directory.GetFiles(Path.Combine(FormMain.itemPath, "Shield"));

                if (weaponNames.Length != 0)
                {
                    foreach (string s in weaponNames)
                    {
                        WeaponData weaponData = XnaSerializer.Deserialize<WeaponData>(s);
                        itemDataManager.WeaponData.Add(weaponData.name, weaponData);
                    }
                }

                if (armorNames.Length != 0)
                {
                    foreach (string s in armorNames)
                    {
                        ArmorData armorData = XnaSerializer.Deserialize<ArmorData>(s);
                        itemDataManager.ArmorData.Add(armorData.name, armorData);
                    }
                }

                if (shieldNames.Length != 0)
                {
                    foreach (string s in shieldNames)
                    {
                        ShieldData shieldData = XnaSerializer.Deserialize<ShieldData>(s);
                        itemDataManager.ShieldData.Add(shieldData.name, shieldData);
                    }
                }
            }
        }
Exemple #4
0
        public static void ReadItemData()
        {
            itemManager = new ItemDataManager();

            string[] fileNames = Directory.GetFiles(
                Path.Combine(FormMain.ItemPath, "Armor"),
                "*.xml");

            foreach (string s in fileNames)
            {
                ArmorData armorData = XnaSerializer.Deserialize<ArmorData>(s);
                itemManager.ArmorData.Add(armorData.Name, armorData);
            }

            fileNames = Directory.GetFiles(
                Path.Combine(FormMain.ItemPath, "Shield"),
                "*.xml");

            foreach (string s in fileNames)
            {
                ShieldData shieldData = XnaSerializer.Deserialize<ShieldData>(s);
                itemManager.ShieldData.Add(shieldData.Name, shieldData);
            }

            fileNames = Directory.GetFiles(
                Path.Combine(FormMain.ItemPath, "Weapon"),
                "*.xml");

            foreach (string s in fileNames)
            {
                WeaponData weaponData = XnaSerializer.Deserialize<WeaponData>(s);
                itemManager.WeaponData.Add(weaponData.Name, weaponData);
            }

        }