Esempio n. 1
0
        private void LoadBiomes()
        {
            XmlDocument xml = new XmlDocument();

            xml.Load("Content/XML/Biomes.xml");
            foreach (XmlNode node in xml.SelectNodes("Biomes/Biome"))
            {
                string uid  = node.Attributes.GetNamedItem("UID").Value;
                string file = node.Attributes.GetNamedItem("File").Value;
                string name = node.Attributes.GetNamedItem("Name").Value;
                try
                {
                    using (Texture2D texture = TextureUtility.LoadTexture(GraphicsDevice, "Content/Graphics/Biomes/" + file))
                    {
                        Texture2D[,] variants = TextureUtility.Split(GraphicsDevice, texture, 64, 64);
                        BasicSprite[] sprites = new BasicSprite[variants.Length];
                        int           i = 0, maxY = variants.GetLength(1), maxX = variants.GetLength(0);
                        for (int y = 0; y < maxY; y++)
                        {
                            for (int x = 0; x < maxX; x++)
                            {
                                sprites[i] = Textures.Copy(variants[x, y]);
                                i++;
                            }
                        }
                        Biome biome = new Biome(uid, name, sprites);
                        Data.Biomes.Add(uid, biome);
                    }
                }
                catch
                {
                }
            }
            Textures.ApplyChanges();
        }
Esempio n. 2
0
        private void Load()
        {
            XmlDocument settings = new XmlDocument();

            settings.Load("Settings.xml");
            //Language = xml.SelectSingleNode("Settings/Localization").Attributes.GetNamedItem("Language").Value;

            foreach (XmlNode mod in settings.SelectNodes("Settings/Mods/Mod"))
            {
                LoadMod("Mods/" + mod.FirstChild.Value);
            }

            foreach (Tuple <IModAsset, XmlElement> data in Uninitialized)
            {
                data.Item1.Initialize(data.Item2, this);
            }

            Uninitialized.Clear();
            TextureAtlases.ApplyChanges();
        }
Esempio n. 3
0
        private void Load()
        {
            XmlDocument xml = new XmlDocument();

            xml.Load("Settings.xml");
            Language = xml.SelectSingleNode("Settings/Localization").Attributes.GetNamedItem("Language").Value;

            foreach (XmlNode node in xml.SelectNodes("Settings/Mods/Mod"))
            {
                LoadMod("Content/" + node.Attributes.GetNamedItem("ID").Value);
            }

            foreach (Tuple <GameData, XmlElement> data in Uninitialized)
            {
                data.Item1.Initialize(data.Item2, this);
            }

            Uninitialized.Clear();
            TextureAtlases.ApplyChanges();
        }