Ejemplo n.º 1
0
        private void doLayout(Rectangle newRectangle)
        {
            this.ControlsPanel.SuspendLayout();
            this.SuspendLayout();

            this.tabs.Location = new Point(0, 0);
            this.tabs.Size     = new Size(newRectangle.Width, newRectangle.Height);

            this.mainPanel.Location = new Point(0, 0);
            this.mainPanel.Size     = new Size(tabs.Size.Width, tabs.Size.Height);

            this.ControlsPanel.Location = new Point((int)(mainPanel.Size.Width * 0.8f), 0);
            this.ControlsPanel.Size     = new Size((int)(mainPanel.Size.Width * 0.2f), mainPanel.Size.Height);
            this.LoadButton.Location    = new Point(0, 0);
            this.LoadButton.Size        = new Size(ControlsPanel.Size.Width / 2, 25);
            this.saveButton.Location    = new Point(ControlsPanel.Size.Width / 2, 0);
            this.saveButton.Size        = new Size(ControlsPanel.Size.Width / 2, 25);
            this.roomComboBox.Location  = new Point(0, 30);
            this.roomComboBox.Size      = new Size(ControlsPanel.Size.Width, 15);
            this.EntityBox.Location     = new Point(0, 50);
            this.EntityBox.Size         = new Size(ControlsPanel.Size.Width, 15);
            this.LabelType.Location     = new Point(0, 75);
            this.LabelType.Size         = new Size(ControlsPanel.Size.Width / 3, 15);
            this.LabelVariant.Location  = new Point(ControlsPanel.Size.Width / 3, 75);
            this.LabelVariant.Size      = new Size(ControlsPanel.Size.Width / 3, 15);
            this.LabelSubtype.Location  = new Point(ControlsPanel.Size.Width / 3 * 2, 75);
            this.LabelSubtype.Size      = new Size(ControlsPanel.Size.Width / 3, 15);


            this.TextboxType.Size        = new Size(ControlsPanel.Size.Width / 3, 20);
            this.TextboxType.Location    = new Point(0, 90);
            this.TextboxVariant.Size     = new Size(ControlsPanel.Size.Width / 3, 20);
            this.TextboxVariant.Location = new Point(ControlsPanel.Size.Width / 3, 90);
            this.TextboxSubType.Size     = new Size(ControlsPanel.Size.Width / 3, 20);
            this.TextboxSubType.Location = new Point(ControlsPanel.Size.Width / 3 * 2, 90);


            this.addButton.Location         = new Point(0, 120);
            this.addButton.Size             = new Size(ControlsPanel.Size.Width / 2, 30);
            this.RemoveButton.Location      = new Point(ControlsPanel.Size.Width / 2, 120);
            this.RemoveButton.Size          = new Size(ControlsPanel.Size.Width / 2, 30);
            this.tileEntityListBox.Location = new Point(0, 150);
            this.tileEntityListBox.Size     = new Size(ControlsPanel.Size.Width, ControlsPanel.Height - 190);
            this.WeightButton.Location      = new Point(0, ControlsPanel.Height - 20);
            this.WeightButton.Size          = new Size(ControlsPanel.Width, 20);
            this.weightTextBox.Location     = new Point(0, ControlsPanel.Height - 40);
            this.weightTextBox.Size         = new Size(ControlsPanel.Width, 20);
            this.TilePanel.Location         = new Point(10, 10);
            this.TilePanel.Size             = new Size((int)(mainPanel.Size.Width * 0.8f - 20), mainPanel.Size.Height - 20);
            //this.lrToggleButton.Location = new Point(12, 411);
            //this.lrToggleButton.Size = new Size(351, 59);
            //this.udToggleButton.Location = new Point(369, 411);
            //this.udToggleButton.Size = new Size(357, 59);
            if (loadedFile != null)
            {
                if (!CurrentRoom.Equals(loadedFile.Rooms [this.roomComboBox.SelectedIndex]))
                {
                    CurrentRoom = loadedFile.Rooms[this.roomComboBox.SelectedIndex];
                    this.TilePanel.Controls.Clear();
                    this.editorButtons = new Button[CurrentRoom.Width * CurrentRoom.Height];
                    for (int i = 0; i < CurrentRoom.Width; i++)
                    {
                        for (int j = 0; j < CurrentRoom.Height; j++)
                        {
                            int index = i + j * CurrentRoom.Width;
                            this.editorButtons [index] = new Button();
                            this.TilePanel.Controls.Add(this.editorButtons [index]);
                            this.editorButtons [index].Click += this.OnClick;
                            this.editorButtons [index].Name   = i + "," + j;
                            this.editorButtons [index].SetBounds(
                                i * TilePanel.Width / 13,
                                j * TilePanel.Width / 13,
                                TilePanel.Width / 13,
                                TilePanel.Width / 13);
                            this.editorButtons[index].BackColor = Color.White;
                        }
                    }
                }
                else
                {
                    CurrentRoom = loadedFile.Rooms[this.roomComboBox.SelectedIndex];
                    for (int i = 0; i < CurrentRoom.Width; i++)
                    {
                        for (int j = 0; j < CurrentRoom.Height; j++)
                        {
                            int index = i + j * CurrentRoom.Width;
                            this.editorButtons [index].SetBounds(
                                i * TilePanel.Width / 13,
                                j * TilePanel.Width / 13,
                                TilePanel.Width / 13,
                                TilePanel.Width / 13);
                            this.editorButtons[index].BackColor = Color.White;
                        }
                    }
                }
            }

            this.ControlsPanel.ResumeLayout(false);
            this.ControlsPanel.PerformLayout();
            this.ResumeLayout(false);
        }