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

            Sprite buttonSprite = Resources.GetSprite("button_idle");
            Sprite[] buttonSpriteTab = new Sprite[] { buttonSprite, Resources.GetSprite("button_over"), Resources.GetSprite("button_pressed") };
            font = Manager.Game.Content.Load<SpriteFont>("Fonts/Hud");
            panel = new Panel(this, new Rectangle(0, 0, Manager.Width, Manager.Height), buttonSprite);

            submitButton = new Button(this, new Rectangle(0, 60, 100, 20), buttonSpriteTab) { Text = "Submit" };
            panel.AddControl("submitButton", submitButton);

            addTileButton = new Button(this, new Rectangle(110, 60, 100, 20), buttonSpriteTab) { Text = "Add Tile" };
            panel.AddControl("addSpriteButton", addTileButton);

            panel.AddControl("tileNameLabel", new TextBlock(this, new Vector2(0, 0), "Name :"));
            tileName = new TextBox(this, new Rectangle(100, 0, 140, 20), buttonSpriteTab);
            panel.AddControl("tileName", tileName);

            panel.AddControl("tileTypeLabel", new TextBlock(this, new Vector2(0, 25), "Type :"));
            tileType = new ListButton(this, new Rectangle(100, 25, 140, 20), buttonSprite, Tile.GetTileTypes().ToList());
            panel.AddControl("tileType", tileType);

            panel.Pading = 10;
            Resize(Manager.Game.Viewport.Width, Manager.Game.Viewport.Height);
        }
예제 #2
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);

            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();
        }
예제 #3
0
        public override void LoadContent()
        {
            base.LoadContent();

            Sprite buttonSprite = Resources.GetSprite("button_idle");
            Sprite[] buttonSpriteTab = new Sprite[] { buttonSprite, Resources.GetSprite("button_over"), Resources.GetSprite("button_pressed") };
            font = Manager.Game.Content.Load<SpriteFont>("Fonts/Hud");
            panel = new Panel(this, new Rectangle(0, 0, Manager.Width, Manager.Height), buttonSprite);

            spriteLib = new SearchableList(this, new Rectangle(0, 0, 200, 400), buttonSprite, buttonSpriteTab, font) { Pading = 5 };
            panel.AddControl("spriteLib", spriteLib);
            foreach (KeyValuePair<string, Sprite> pair in Resources.Sprites)
                spriteLib.AddToList(pair.Key);

            spriteSelected = new SearchableList(this, new Rectangle(400, 0, 200, 300), buttonSprite, buttonSpriteTab, font) { Pading = 5 };
            panel.AddControl("spriteSelected", spriteSelected);

            textureDrawerLib = new TextureDrawer(this, new Rectangle(200, 0, 200, 200), null);
            panel.AddControl("textureDrawerLib", textureDrawerLib);

            textureDrawerSelected = new TextureDrawer(this, new Rectangle(600, 0, 200, 200), null);
            panel.AddControl("textureDrawerSelected", textureDrawerSelected);

            submitButton = new Button(this, new Rectangle(0, 410, 100, 20), buttonSpriteTab) { Text = "Submit" };
            panel.AddControl("submitButton", submitButton);

            addAnimationButton = new Button(this, new Rectangle(350, 410, 100, 20), buttonSpriteTab) { Text = "Add Animation" };
            panel.AddControl("addSpriteButton", addAnimationButton);

            toLeftButton = new Button(this, new Rectangle(285, 255, 30, 30), buttonSpriteTab) { Text = " <-" };
            panel.AddControl("toLeftButton", toLeftButton);

            toRightButton = new Button(this, new Rectangle(285, 220, 30, 30), buttonSpriteTab) { Text = " ->" };
            panel.AddControl("toRightButton", toRightButton);

            toUpButton = new Button(this, new Rectangle(340, 220, 30, 30), buttonSpriteTab) { Text = "Up" };
            panel.AddControl("toUpButton", toUpButton);

            toDownButton = new Button(this, new Rectangle(340, 255, 30, 30), buttonSpriteTab) { Text = "Down" };
            panel.AddControl("toDownButton", toDownButton);

            frameTimeLabel = new TextBlock(this, new Vector2(400, 305), "FrameTime :");
            panel.AddControl("frameTimeLabel", frameTimeLabel);

            frameTimeTextBox = new TextBox(this, new Rectangle(520, 305, 80, 20), buttonSpriteTab);
            panel.AddControl("frameTimeText", frameTimeTextBox);

            panel.AddControl("effectButtonLabel", new TextBlock(this, new Vector2(400, 325), "Effect :"));
            effectButton = new ListButton(this, new Rectangle(470, 325, 130, 20), buttonSprite, new List<string>() { "None", "FlipVertically", "FlipHorizontally", "FlipBoth" });
            panel.AddControl("effectButton", effectButton);

            addSpriteText = new TextBox(this, new Rectangle(210, 410, 140, 20), buttonSpriteTab);
            panel.AddControl("addSpriteText", addSpriteText);

            panel.Pading = 10;
            Resize(Manager.Game.Viewport.Width, Manager.Game.Viewport.Height);
        }
예제 #4
0
        private void ReconstructLocTileDataPanel()
        {
            locTileDataSubmitButton = null;
            locTileRemoveButton = null;
            locTileDataPanel.RemoveAllControl();
            if (selectedLocTile != null && selectedLocTile is IEditable)
            {
                IEditable ent = (IEditable)selectedLocTile;
                locTileDataForm = ent.GetEditingForm();

                Sprite buttonSprite = World.Resources.GetSprite("button_idle");
                Sprite[] buttonSpriteTab = new Sprite[] { buttonSprite, World.Resources.GetSprite("button_over"), World.Resources.GetSprite("button_pressed") };

                Rectangle nextRectangle = new Rectangle(120, locTileAddButton.Bound.Bottom + 5, locTileDataPanel.Bound.Width - 120 - 5, 25);
                foreach (KeyValuePair<string, object> pair in locTileDataForm.Datas)
                {
                    locTileDataPanel.AddControl(pair.Key + "T", new TextBlock(this, new Vector2(0, nextRectangle.Y), pair.Key));
                    if (pair.Value is string || pair.Value is int || pair.Value is float)
                    {
                        locTileDataPanel.AddControl(pair.Key, new TextBox(this, nextRectangle, buttonSpriteTab));
                        ((TextBox)locTileDataPanel.SubControls[pair.Key]).Text = pair.Value.ToString();
                    }
                    else if (pair.Value is bool)
                    {
                        locTileDataPanel.AddControl(pair.Key, new ToggleButton(this, nextRectangle, buttonSpriteTab));
                        ((ToggleButton)locTileDataPanel.SubControls[pair.Key]).SetState((bool)pair.Value);
                    }
                    else if (pair.Value is Point)
                    {
                        Rectangle rect = nextRectangle;
                        rect.Width = nextRectangle.Width / 2 - 5;
                        locTileDataPanel.AddControl(pair.Key, new TextBox(this, rect, buttonSpriteTab));
                        ((TextBox)locTileDataPanel.SubControls[pair.Key]).Text = ((Point)(pair.Value)).X.ToString();
                        rect.X += rect.Width + 10;
                        locTileDataPanel.AddControl(pair.Key + "_Y", new TextBox(this, rect, buttonSpriteTab));
                        ((TextBox)locTileDataPanel.SubControls[pair.Key + "_Y"]).Text = ((Point)(pair.Value)).Y.ToString();
                    }
                    else if (pair.Value is Enum)
                    {
                        Type enumType = pair.Value.GetType();
                        ListButton control = new ListButton(this, nextRectangle, buttonSprite, new List<string>(Enum.GetNames(enumType)));
                        control.SelectValue(Enum.GetName(enumType, pair.Value));
                        locTileDataPanel.AddControl(pair.Key, control);
                    }
                    else if (pair.Value is Controller)
                    {
                        ListButton control = new ListButton(this, nextRectangle, buttonSprite, new List<string>(Entity.Controllers.GetAll()));
                        control.SelectValue(Entity.Controllers.GetName((Controller)pair.Value));
                        locTileDataPanel.AddControl(pair.Key, control);
                    }
                    else if (pair.Value is Sprite)
                    {
                        Rectangle rect = nextRectangle;
                        rect.Right -= 30;
                        ListButton control = new ListButton(this, rect, buttonSprite, new List<string>(World.Resources.Sprites.Keys));
                        control.SelectValue(World.Resources.GetName((Sprite)pair.Value));
                        locTileDataPanel.AddControl(pair.Key, control);
                        rect.Left = rect.Right;
                        rect.Right += 30;
                        rect.Left += 10;
                        Button button = new Button(this, rect, buttonSpriteTab);
                        button.Text = "...";
                        locTileDataPanel.AddControl("addSprite_" + pair.Key, button);
                    }
                    else if (pair.Value is Animation)
                    {
                        Rectangle rect = nextRectangle;
                        rect.Right -= 30;
                        ListButton control = new ListButton(this, rect, buttonSprite, new List<string>(World.Resources.Animations.Keys));
                        control.SelectValue(World.Resources.GetName((Animation)pair.Value));
                        locTileDataPanel.AddControl(pair.Key, control);
                        rect.Left = rect.Right;
                        rect.Right += 30;
                        rect.Left += 10;
                        Button button = new Button(this, rect, buttonSpriteTab);
                        button.Text = "...";
                        locTileDataPanel.AddControl("addAnimation_" + pair.Key, button);
                    }
                    nextRectangle.Y += 30;
                }
                nextRectangle.Width = 65;
                locTileDataSubmitButton = new Button(this, nextRectangle, buttonSpriteTab);
                locTileDataSubmitButton.Text = "Submit";
                locTileDataPanel.AddControl("submitButton", locTileDataSubmitButton);
                nextRectangle.X = 0;
                nextRectangle.Width = 75;
                locTileRemoveButton = new Button(this, nextRectangle, buttonSpriteTab) { Text = "Remove" };
                locTileDataPanel.AddControl("locTileRemoveButton", locTileRemoveButton);
            }
        }
예제 #5
0
        public override void LoadContent()
        {
            base.LoadContent();

            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");
            panel = new Panel(this, new Rectangle(0, 0, Manager.Width, Manager.Height), buttonSprite);

            Rectangle nextRectangle = new Rectangle(100, 0, 160, 20);
            foreach (KeyValuePair<string, object> pair in Form.Datas)
            {
                panel.AddControl(pair.Key + "T", new TextBlock(this, new Vector2(0, nextRectangle.Y), pair.Key));
                if (pair.Value is string || pair.Value is int || pair.Value is float)
                {
                    panel.AddControl(pair.Key, new TextBox(this, nextRectangle, buttonSpriteTab));
                    ((TextBox)panel.SubControls[pair.Key]).Text = pair.Value.ToString();
                }
                else if (pair.Value is bool)
                {
                    panel.AddControl(pair.Key, new ToggleButton(this, nextRectangle, buttonSpriteTab));
                    ((ToggleButton)panel.SubControls[pair.Key]).SetState((bool)pair.Value);
                }
                else if (pair.Value is Point)
                {
                    Rectangle rect = nextRectangle;
                    rect.Width = nextRectangle.Width / 2 - 5;
                    panel.AddControl(pair.Key, new TextBox(this, rect, buttonSpriteTab));
                    ((TextBox)panel.SubControls[pair.Key]).Text = ((Point)(pair.Value)).X.ToString();
                    rect.X += rect.Width + 10;
                    panel.AddControl(pair.Key + "_Y", new TextBox(this, rect, buttonSpriteTab));
                    ((TextBox)panel.SubControls[pair.Key + "_Y"]).Text = ((Point)(pair.Value)).Y.ToString();
                }
                else if (pair.Value is Enum)
                {
                    Type enumType = pair.Value.GetType();
                    ListButton control = new ListButton(this, nextRectangle, buttonSprite, new List<string>(Enum.GetNames(enumType)));
                    control.SelectValue(Enum.GetName(enumType, pair.Value));
                    panel.AddControl(pair.Key, control);
                }
                else if (pair.Value is Controller)
                {
                    ListButton control = new ListButton(this, nextRectangle, buttonSprite, new List<string>(Entity.Controllers.GetAll()));
                    control.SelectValue(Entity.Controllers.GetName((Controller)pair.Value));
                    panel.AddControl(pair.Key, control);
                }
                else if (pair.Value is Sprite)
                {
                    Rectangle rect = nextRectangle;
                    rect.Right -= 30;
                    ListButton control = new ListButton(this, rect, buttonSprite, new List<string>(World.Resources.Sprites.Keys));
                    control.SelectValue(World.Resources.GetName((Sprite)pair.Value));
                    panel.AddControl(pair.Key, control);
                    rect.Left = rect.Right;
                    rect.Right += 30;
                    rect.Left += 10;
                    Button button = new Button(this, rect, buttonSpriteTab);
                    button.Text = "...";
                    panel.AddControl("addSprite_" + pair.Key, button);
                }
                else if (pair.Value is Animation)
                {
                    Rectangle rect = nextRectangle;
                    rect.Right -= 30;
                    ListButton control = new ListButton(this, rect, buttonSprite, new List<string>(World.Resources.Animations.Keys));
                    control.SelectValue(World.Resources.GetName((Animation)pair.Value));
                    panel.AddControl(pair.Key, control);
                    rect.Left = rect.Right;
                    rect.Right += 30;
                    rect.Left += 10;
                    Button button = new Button(this, rect, buttonSpriteTab);
                    button.Text = "...";
                    panel.AddControl("addAnimation_" + pair.Key, button);
                }
                nextRectangle.Y += 30;
            }
            submitButton = new Button(this, nextRectangle, buttonSpriteTab);
            submitButton.Text = "Submit";
            panel.AddControl("submitButton", submitButton);
            panel.Pading = 10;

            Resize(Manager.Game.Viewport.Width, Manager.Game.Viewport.Height);
        }