// ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- public DialogPreviewGraphicSelectRectangle(SystemGraphic graphic, OptionsKind optionsKind, SystemGraphic graphicTileset = null) : base(graphic, optionsKind, graphicTileset) { OptionsKind = optionsKind; // Picture PictureBox = new PixelSelectPictureBox(); PictureBox.SizeMode = PictureBoxSizeMode.StretchImage; PictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; PictureBox.BackColor = WANOK.COLOR_BACKGROUND_PREVIEW_IMAGE; panelPicture.Controls.Clear(); panelPicture.Controls.Add(PictureBox); // Options GrowLabel label = new GrowLabel(); label.Dock = DockStyle.Fill; switch (optionsKind) { case OptionsKind.BarSelection: label.Text = "Select the rectangle that represents the filled bar:"; break; } label.Margin = new Padding(0, 0, 0, 20); tableLayoutPanel4.Controls.Add(label, 0, 2); TableLayoutPanel panelRectangle = new TableLayoutPanel(); panelRectangle.Dock = DockStyle.Fill; panelRectangle.RowCount = 5; panelRectangle.ColumnCount = 2; tableLayoutPanel4.Controls.Add(panelRectangle, 0, 3); Label rectangleLabel = new Label(); rectangleLabel.Text = "X:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 0); rectangleLabel = new Label(); rectangleLabel.Text = "Y:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 1); rectangleLabel = new Label(); rectangleLabel.Text = "Width:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 2); rectangleLabel = new Label(); rectangleLabel.Text = "Height:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 3); numericButtonX.Minimum = 0; numericButtonY.Minimum = 0; numericButtonWidth.Minimum = 1; numericButtonHeight.Minimum = 1; numericButtonX.Maximum = 32000; numericButtonY.Maximum = 32000; numericButtonWidth.Maximum = 32000; numericButtonHeight.Maximum = 32000; numericButtonX.Value = (int)graphic.Options[0]; numericButtonY.Value = (int)graphic.Options[1]; numericButtonWidth.Value = (int)graphic.Options[2]; numericButtonHeight.Value = (int)graphic.Options[3]; panelRectangle.Controls.Add(numericButtonX, 1, 0); panelRectangle.Controls.Add(numericButtonY, 1, 1); panelRectangle.Controls.Add(numericButtonWidth, 1, 2); panelRectangle.Controls.Add(numericButtonHeight, 1, 3); panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50)); panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); // Update image rectangle PictureBox.SelectionRectangle.X = (int)numericButtonX.Value; PictureBox.SelectionRectangle.Y = (int)numericButtonY.Value; PictureBox.SelectionRectangle.Width = (int)numericButtonWidth.Value; PictureBox.SelectionRectangle.Height = (int)numericButtonHeight.Value; PictureBox.Refresh(); // Events PictureBox.MouseEnter += PictureBox_MouseEnter; PictureBox.MouseDown += PictureBox_MouseDown; PictureBox.MouseUp += PictureBox_MouseUp; PictureBox.MouseMove += PictureBox_MouseMove; numericButtonX.ValueChanged += UpdateRectangle; numericButtonY.ValueChanged += UpdateRectangle; numericButtonWidth.ValueChanged += UpdateRectangle; numericButtonHeight.ValueChanged += UpdateRectangle; listView1.SelectedIndexChanged += UpdateRectangle; }
// ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- public DialogAddingReliefsList(string text, TilesetsDatas model, SystemTileset tileset) : base(text, model, tileset.Reliefs, typeof(SystemRelief)) { Tileset = tileset; ReliefsTop = tileset.CreateReliefTopCopy(); Model = model; TextBoxVariable.InitializeParameters(new object[] { 0, 0, 1, 1 }, new List <object>(new object[] { Tileset.Graphic }), typeof(DialogTileset), WANOK.GetStringTileset); ComboBoxAutotile.Dock = DockStyle.Fill; ComboBoxAutotile.FillComboBox(Tileset.Autotiles, Model.GetAutotileById, Model.GetAutotileIndexById, 0); // Radios Radios[DrawType.None] = new RadioButton(); Radios[DrawType.None].Text = "None"; Radios[DrawType.Floors] = new RadioButton(); Radios[DrawType.Floors].Text = "Floor"; Radios[DrawType.Autotiles] = new RadioButton(); Radios[DrawType.Autotiles].Text = "Autotile"; // Fill boxes listBoxComplete.GetListBox().SelectedIndexChanged += listBoxComplete_SelectedIndexChanged; listBoxComplete.InitializeListParameters(true, WANOK.GetSuperListItem(model.Reliefs.Cast <SuperListItem>().ToList()), null, Type, 1, SystemRelief.MAX_RELIEFS); List <SuperListItem> modelTileset = new List <SuperListItem>(); for (int i = 0; i < tileset.Reliefs.Count; i++) { modelTileset.Add(model.GetReliefById(tileset.Reliefs[i])); } listBoxTileset.GetListBox().SelectedIndexChanged += ListBoxTileset_SelectedIndexChanged; listBoxTileset.InitializeListParameters(true, modelTileset, null, Type, 0, 0, false); // PictureRelief PictureBox.SizeMode = PictureBoxSizeMode.StretchImage; PictureBox.InterpolationMode = InterpolationMode.NearestNeighbor; PicturePanel.AutoScroll = true; PicturePanel.Dock = DockStyle.Fill; PicturePanel.BackColor = System.Drawing.Color.FromArgb(227, 227, 227); PicturePanel.Controls.Add(PictureBox); // Floor Panel RadioPanel.Dock = DockStyle.Fill; RadioPanel.RowCount = 3; RadioPanel.ColumnCount = 2; RadioPanel.Controls.Add(Radios[DrawType.None], 0, 0); RadioPanel.Controls.Add(Radios[DrawType.Floors], 0, 1); RadioPanel.Controls.Add(Radios[DrawType.Autotiles], 0, 2); RadioPanel.Controls.Add(new Panel(), 1, 0); RadioPanel.Controls.Add(TextBoxVariable, 1, 1); RadioPanel.Controls.Add(ComboBoxAutotile, 1, 2); RadioPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 25)); RadioPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 29)); RadioPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 25)); RadioPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); RadioPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); FloorPanel.Dock = DockStyle.Fill; FloorPanel.RowCount = 2; FloorPanel.ColumnCount = 1; GrowLabel label = new GrowLabel(); label.Dock = DockStyle.Fill; label.Text = "Choose what kind of floor there is on top of a mountains/slopes:"; FloorPanel.Controls.Add(label, 0, 0); FloorPanel.Controls.Add(RadioPanel, 0, 1); FloorPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 15)); FloorPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); // Setting layout LayoutPanel.Dock = DockStyle.Fill; LayoutPanel.RowCount = 1; LayoutPanel.ColumnCount = 1; LayoutPanel.Controls.Add(PicturePanel, 0, 0); LayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); PanelOther.Controls.Add(LayoutPanel); tableLayoutPanel8.RowStyles.Add(new RowStyle(SizeType.Percent, 50)); tableLayoutPanel8.RowStyles.Add(new RowStyle(SizeType.Percent, 50)); tableLayoutPanel8.Controls.Add(FloorPanel, 0, 1); FloorPanel.Visible = listBoxTileset.GetListBox().Items.Count > 0; // Events textBoxGraphic.GetTextBox().SelectedValueChanged += textBoxGraphic_SelectedValueChanged; listBoxComplete.GetListBox().MouseDown += listBoxComplete_SelectedIndexChanged; listBoxComplete.GetButton().Click += listBoxComplete_Click; buttonDelete.Click += ButtonDelete_Click; Radios[DrawType.None].CheckedChanged += RadioCheckedNone; Radios[DrawType.Floors].CheckedChanged += RadioCheckedFloor; Radios[DrawType.Autotiles].CheckedChanged += RadioCheckedAutotile; ComboBoxAutotile.SelectedIndexChanged += ComboBoxAutotileSelectedIndexChanged; buttonAdd.Click += ButtonAdd_Click; listBoxComplete.GetListBox().DoubleClick += ListBoxComplete_DoubleClick; TextBoxVariable.GetTextBox().SelectedValueChanged += TextVariable_SelectedValueChanged; listBoxTileset.GetListBox().DragDrop += ListBoxTileset_DragDrop; listBoxTileset.GetListBox().MouseDown += ListBoxTileset_SelectedIndexChanged; }
// ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- public DialogPreviewGraphicSelectFrame(SystemGraphic graphic, OptionsKind optionsKind, SystemGraphic graphicTileset = null) : base(graphic, optionsKind, graphicTileset) { OptionsKind = optionsKind; // Picture PictureBox = new TilesetSelectorPicture(); PictureBox.SizeMode = PictureBoxSizeMode.StretchImage; PictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; PictureBox.BackColor = WANOK.COLOR_BACKGROUND_PREVIEW_IMAGE; panelPicture.Controls.Clear(); panelPicture.Controls.Add(PictureBox); // Options GrowLabel label = new GrowLabel(); label.Dock = DockStyle.Fill; switch (optionsKind) { case OptionsKind.CharacterSelection: label.Text = "Select the number of frames and if there are diagonals:"; break; } label.Margin = new Padding(0, 0, 0, 20); tableLayoutPanel4.Controls.Add(label, 0, 2); TableLayoutPanel panelRectangle = new TableLayoutPanel(); panelRectangle.Dock = DockStyle.Fill; panelRectangle.RowCount = 3; panelRectangle.ColumnCount = 2; tableLayoutPanel4.Controls.Add(panelRectangle, 0, 3); Label rectangleLabel = new Label(); rectangleLabel.Text = "Frames:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 0); rectangleLabel = new Label(); rectangleLabel.Text = "Diagonals:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 1); NumericFrames.Minimum = 1; NumericFrames.Maximum = 999; NumericFrames.Value = (int)graphic.Options[(int)SystemGraphic.OptionsEnum.Frames]; panelRectangle.Controls.Add(NumericFrames, 1, 0); ComboBoxDialog.DropDownStyle = ComboBoxStyle.DropDownList; ComboBoxDialog.Items.Add("No"); ComboBoxDialog.Items.Add("Yes"); ComboBoxDialog.SelectedIndex = (int)graphic.Options[(int)SystemGraphic.OptionsEnum.Diagonal]; panelRectangle.Controls.Add(ComboBoxDialog, 1, 1); panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 63)); panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); // Actualize list (delete _act) and adding tileset List <ListViewItem> list = new List <ListViewItem>(); for (int i = 0; i < listView1.Items.Count; i++) { list.Add(listView1.Items[i]); } for (int i = 1; i < list.Count; i++) { string path = Path.GetFileNameWithoutExtension(list[i].Text); if (path.Length - 4 >= 0) { if (path.Substring(path.Length - 4, 4) == "_act") { listView1.Items.Remove(list[i]); } } } listView1.Items.Insert(1, WANOK.TILESET_IMAGE_STRING); // Events PictureBox.MouseEnter += PictureBox_MouseEnter; PictureBox.MouseDown += PictureBox_MouseDown; PictureBox.MouseUp += PictureBox_MouseUp; listView1.SelectedIndexChanged += ListView1_SelectedIndexChanged; NumericFrames.ValueChanged += NumericFrames_ValueChanged; ComboBoxDialog.SelectedIndexChanged += ComboBoxDialog_SelectedIndexChanged; }