Exemple #1
0
        public override void LoadContent()
        {
            base.LoadContent();

            XmlDocument doc = new XmlDocument();
            doc.Load("save.xml");

            XmlElement worldElem = (XmlElement)doc.GetElementsByTagName("World").Item(0);
            World = new World(this, doc, worldElem);
        }
Exemple #2
0
        public FormScreen(ScreenManager manager, Form baseForm, World world)
            : base(manager)
        {
            OpeningTransition = new NoneTransition(Transition.Types.Opening);
            ClosingTransition = new NoneTransition(Transition.Types.Closing);

            World = world;
            Form = baseForm;
            IsSubmitted = false;
        }
        public override void LoadContent()
        {
            base.LoadContent();

            XmlDocument doc = new XmlDocument();
            doc.Load("save.xml");

            XmlElement worldElem = (XmlElement)doc.GetElementsByTagName("World").Item(0);
            World = new World(this, doc, worldElem);

            Sprite buttonSprite = World.Resources.GetSprite("button_idle");
            Sprite[] buttonSpriteTab = new Sprite[] { buttonSprite, World.Resources.GetSprite("button_over"), World.Resources.GetSprite("button_pressed") };
            font = Manager.Game.Content.Load<SpriteFont>("Fonts/Hud");

            tabPanel = new TabPanels(this, Rectangle.Empty, buttonSpriteTab);
            tilePanel = new Panel(this, Rectangle.Empty, buttonSprite) { Pading = 5 };
            tileList = new SearchableList(this, Rectangle.Empty, buttonSprite, buttonSpriteTab, font);
            tilePanel.AddControl("tileList", tileList);
            tileAddButton = new Button(this, Rectangle.Empty, buttonSpriteTab) { Text = "Add" };
            tilePanel.AddControl("tileAddButton", tileAddButton);
            tileRemoveButton = new Button(this, Rectangle.Empty, buttonSpriteTab) { Text = "Remove" };
            tilePanel.AddControl("tileRemoveButton", tileRemoveButton);
            tileDataPanel = new Panel(this, Rectangle.Empty, null);
            tilePanel.AddControl("tileDataPanel", tileDataPanel);
            tabPanel.AddPanel("Tile", tilePanel, 35);

            entityPanel = new Panel(this, Rectangle.Empty, buttonSprite) { Pading = 5 };
            TextBlock entityListButtonLabel = new TextBlock(this, Vector2.Zero, "Type");
            entityPanel.AddControl("entityListButtonLabel", entityListButtonLabel);
            entityListButton = new ListButton(this, new Rectangle(50, 0, 100, 25), buttonSprite, new List<string>(Entity.GetEntityTypes()));
            entityPanel.AddControl("entityListButton", entityListButton);
            entityAddButton = new Button(this, new Rectangle(5, 30, 40, 25), buttonSpriteTab) { Text = "Add" };
            entityPanel.AddControl("entityAddButton", entityAddButton);
            entityDataPanel = new Panel(this, Rectangle.Empty, null);
            entityPanel.AddControl("entityDataPanel", entityDataPanel);
            tabPanel.AddPanel("Entity", entityPanel, 52);

            locTilePanel = new Panel(this, Rectangle.Empty, buttonSprite) { Pading = 5 };
            TextBlock locTileListButtonLabel = new TextBlock(this, Vector2.Zero, "Type");
            locTilePanel.AddControl("locTileListButtonLabel", locTileListButtonLabel);
            locTileListButton = new ListButton(this, new Rectangle(50, 0, 100, 25), buttonSprite, new List<string>(Tile.GetLocTileTypes()));
            locTilePanel.AddControl("locTileListButton", locTileListButton);
            locTileAddButton = new Button(this, new Rectangle(5, 30, 40, 25), buttonSpriteTab) { Text = "Add" };
            locTilePanel.AddControl("locTileAddButton", locTileAddButton);
            locTileDataPanel = new Panel(this, Rectangle.Empty, null);
            locTilePanel.AddControl("locTileDataPanel", locTileDataPanel);
            tabPanel.AddPanel("LocTile", locTilePanel, 65);

            Resize(Manager.Game.Viewport.Width, Manager.Game.Viewport.Height);
            UpdateDatas();
        }
Exemple #4
0
        public Resources(World world, string path)
        {
            World = world;
            SpriteSheets = new Dictionary<string, SpriteSheet>();
            Sprites = new Dictionary<string, Sprite>();
            Animations = new Dictionary<string, Animation>();


            XmlDocument doc = new XmlDocument();
            doc.Load(path);

            XmlElement sheetsElem = (XmlElement)doc.GetElementsByTagName("SpriteSheets").Item(0);
            foreach (XmlElement elem in sheetsElem.ChildNodes)
                SpriteSheets.Add(elem.Name, new SpriteSheet(doc, elem, PokeSiGame.Instance));

            XmlElement spritesElem = (XmlElement)doc.GetElementsByTagName("Sprites").Item(0);
            foreach (XmlElement elem in spritesElem.ChildNodes)
                Sprites.Add(elem.Name, new Sprite(doc, elem, this));

            XmlElement animsElem = (XmlElement)doc.GetElementsByTagName("Animations").Item(0);
            foreach (XmlElement elem in animsElem.ChildNodes)
                Animations.Add(elem.Name, new Animation(doc, elem, this));
        }