Лабораторная №5 готова

This commit is contained in:
ShabOl 2023-11-19 18:24:41 +04:00
parent 5510581b53
commit 344fbdbca8
11 changed files with 735 additions and 36 deletions

View File

@ -0,0 +1,6 @@
using AirBomber.Rendering;
namespace AirBomber
{
public delegate void BomberDelegate(BomberRendererBase Renderer);
}

View File

@ -13,5 +13,10 @@
this.FuelTanks = FuelTanks;
this.Bombs = Bombs;
}
public void SetAdditionalColor(Color AdditionalColor)
{
this.AdditionalColor = AdditionalColor;
}
}
}

View File

@ -13,5 +13,10 @@
this.Weight = Weight;
this.BodyColor = BodyColor;
}
public void SetBaseColor(Color BaseColor)
{
BodyColor = BaseColor;
}
}
}

370
AirBomber/FormBomberConfig.Designer.cs generated Normal file
View File

@ -0,0 +1,370 @@
namespace AirBomber
{
partial class FormBomberConfig
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
ParamsGroupBox = new GroupBox();
AdvancedEntityLabel = new Label();
BaseEntityLabel = new Label();
ColorsGroupBox = new GroupBox();
VioletPanel = new Panel();
BlackPanel = new Panel();
GrayPanel = new Panel();
WhitePanel = new Panel();
OrangePanel = new Panel();
BluePanel = new Panel();
GreenPanel = new Panel();
RedPanel = new Panel();
FuelTanksCheckbox = new CheckBox();
BombsCheckBox = new CheckBox();
WeightNumericUpDown = new NumericUpDown();
SpeedNumericUpDown = new NumericUpDown();
WeightLabel = new Label();
SpeedLabel = new Label();
ObjectRepresentationPanel = new Panel();
EntityPictureBox = new PictureBox();
AdditionalColorLabel = new Label();
ColorLabel = new Label();
AddButton = new Button();
ConfigCancelButton = new Button();
ParamsGroupBox.SuspendLayout();
ColorsGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)WeightNumericUpDown).BeginInit();
((System.ComponentModel.ISupportInitialize)SpeedNumericUpDown).BeginInit();
ObjectRepresentationPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)EntityPictureBox).BeginInit();
SuspendLayout();
//
// ParamsGroupBox
//
ParamsGroupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
ParamsGroupBox.Controls.Add(AdvancedEntityLabel);
ParamsGroupBox.Controls.Add(BaseEntityLabel);
ParamsGroupBox.Controls.Add(ColorsGroupBox);
ParamsGroupBox.Controls.Add(FuelTanksCheckbox);
ParamsGroupBox.Controls.Add(BombsCheckBox);
ParamsGroupBox.Controls.Add(WeightNumericUpDown);
ParamsGroupBox.Controls.Add(SpeedNumericUpDown);
ParamsGroupBox.Controls.Add(WeightLabel);
ParamsGroupBox.Controls.Add(SpeedLabel);
ParamsGroupBox.Location = new Point(12, 12);
ParamsGroupBox.Name = "ParamsGroupBox";
ParamsGroupBox.Size = new Size(555, 343);
ParamsGroupBox.TabIndex = 0;
ParamsGroupBox.TabStop = false;
ParamsGroupBox.Text = "Параметры";
//
// AdvancedEntityLabel
//
AdvancedEntityLabel.BorderStyle = BorderStyle.FixedSingle;
AdvancedEntityLabel.Location = new Point(391, 200);
AdvancedEntityLabel.Name = "AdvancedEntityLabel";
AdvancedEntityLabel.Size = new Size(110, 40);
AdvancedEntityLabel.TabIndex = 9;
AdvancedEntityLabel.Text = "Продвинутый";
AdvancedEntityLabel.TextAlign = ContentAlignment.MiddleCenter;
AdvancedEntityLabel.MouseDown += LabelObject_MouseDown;
//
// BaseEntityLabel
//
BaseEntityLabel.BorderStyle = BorderStyle.FixedSingle;
BaseEntityLabel.Location = new Point(250, 200);
BaseEntityLabel.Name = "BaseEntityLabel";
BaseEntityLabel.Size = new Size(110, 40);
BaseEntityLabel.TabIndex = 8;
BaseEntityLabel.Text = "Простой";
BaseEntityLabel.TextAlign = ContentAlignment.MiddleCenter;
BaseEntityLabel.MouseDown += LabelObject_MouseDown;
//
// ColorsGroupBox
//
ColorsGroupBox.Controls.Add(VioletPanel);
ColorsGroupBox.Controls.Add(BlackPanel);
ColorsGroupBox.Controls.Add(GrayPanel);
ColorsGroupBox.Controls.Add(WhitePanel);
ColorsGroupBox.Controls.Add(OrangePanel);
ColorsGroupBox.Controls.Add(BluePanel);
ColorsGroupBox.Controls.Add(GreenPanel);
ColorsGroupBox.Controls.Add(RedPanel);
ColorsGroupBox.Location = new Point(235, 22);
ColorsGroupBox.Name = "ColorsGroupBox";
ColorsGroupBox.Size = new Size(281, 155);
ColorsGroupBox.TabIndex = 7;
ColorsGroupBox.TabStop = false;
ColorsGroupBox.Text = "Цвета";
//
// VioletPanel
//
VioletPanel.BackColor = Color.BlueViolet;
VioletPanel.ForeColor = SystemColors.ControlText;
VioletPanel.Location = new Point(216, 90);
VioletPanel.Name = "VioletPanel";
VioletPanel.Size = new Size(50, 50);
VioletPanel.TabIndex = 4;
//
// BlackPanel
//
BlackPanel.BackColor = Color.Black;
BlackPanel.ForeColor = SystemColors.ControlText;
BlackPanel.Location = new Point(150, 90);
BlackPanel.Name = "BlackPanel";
BlackPanel.Size = new Size(50, 50);
BlackPanel.TabIndex = 3;
//
// GrayPanel
//
GrayPanel.BackColor = Color.LightSlateGray;
GrayPanel.ForeColor = SystemColors.ControlText;
GrayPanel.Location = new Point(82, 90);
GrayPanel.Name = "GrayPanel";
GrayPanel.Size = new Size(50, 50);
GrayPanel.TabIndex = 2;
//
// WhitePanel
//
WhitePanel.BackColor = Color.White;
WhitePanel.ForeColor = SystemColors.ControlText;
WhitePanel.Location = new Point(15, 90);
WhitePanel.Name = "WhitePanel";
WhitePanel.Size = new Size(50, 50);
WhitePanel.TabIndex = 1;
//
// OrangePanel
//
OrangePanel.BackColor = Color.Orange;
OrangePanel.ForeColor = SystemColors.ControlText;
OrangePanel.Location = new Point(216, 22);
OrangePanel.Name = "OrangePanel";
OrangePanel.Size = new Size(50, 50);
OrangePanel.TabIndex = 3;
//
// BluePanel
//
BluePanel.BackColor = Color.RoyalBlue;
BluePanel.ForeColor = SystemColors.ControlText;
BluePanel.Location = new Point(150, 22);
BluePanel.Name = "BluePanel";
BluePanel.Size = new Size(50, 50);
BluePanel.TabIndex = 2;
//
// GreenPanel
//
GreenPanel.BackColor = Color.Green;
GreenPanel.ForeColor = SystemColors.ControlText;
GreenPanel.Location = new Point(82, 22);
GreenPanel.Name = "GreenPanel";
GreenPanel.Size = new Size(50, 50);
GreenPanel.TabIndex = 1;
//
// RedPanel
//
RedPanel.BackColor = Color.Red;
RedPanel.ForeColor = SystemColors.ControlText;
RedPanel.Location = new Point(15, 22);
RedPanel.Name = "RedPanel";
RedPanel.Size = new Size(50, 50);
RedPanel.TabIndex = 0;
//
// FuelTanksCheckbox
//
FuelTanksCheckbox.AutoSize = true;
FuelTanksCheckbox.Location = new Point(20, 158);
FuelTanksCheckbox.Name = "FuelTanksCheckbox";
FuelTanksCheckbox.Size = new Size(174, 19);
FuelTanksCheckbox.TabIndex = 5;
FuelTanksCheckbox.Text = "Наличие топливных баков";
FuelTanksCheckbox.UseVisualStyleBackColor = true;
//
// BombsCheckBox
//
BombsCheckBox.AutoSize = true;
BombsCheckBox.Location = new Point(20, 123);
BombsCheckBox.Name = "BombsCheckBox";
BombsCheckBox.Size = new Size(108, 19);
BombsCheckBox.TabIndex = 4;
BombsCheckBox.Text = "Наличие бомб";
BombsCheckBox.UseVisualStyleBackColor = true;
//
// WeightNumericUpDown
//
WeightNumericUpDown.Location = new Point(88, 71);
WeightNumericUpDown.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
WeightNumericUpDown.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
WeightNumericUpDown.Name = "WeightNumericUpDown";
WeightNumericUpDown.Size = new Size(120, 23);
WeightNumericUpDown.TabIndex = 3;
WeightNumericUpDown.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// SpeedNumericUpDown
//
SpeedNumericUpDown.Location = new Point(88, 32);
SpeedNumericUpDown.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
SpeedNumericUpDown.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
SpeedNumericUpDown.Name = "SpeedNumericUpDown";
SpeedNumericUpDown.Size = new Size(120, 23);
SpeedNumericUpDown.TabIndex = 2;
SpeedNumericUpDown.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// WeightLabel
//
WeightLabel.AutoSize = true;
WeightLabel.Location = new Point(20, 73);
WeightLabel.Name = "WeightLabel";
WeightLabel.Size = new Size(29, 15);
WeightLabel.TabIndex = 1;
WeightLabel.Text = "Вес:";
//
// SpeedLabel
//
SpeedLabel.AutoSize = true;
SpeedLabel.Location = new Point(20, 34);
SpeedLabel.Name = "SpeedLabel";
SpeedLabel.Size = new Size(62, 15);
SpeedLabel.TabIndex = 0;
SpeedLabel.Text = "Скорость:";
//
// ObjectRepresentationPanel
//
ObjectRepresentationPanel.AllowDrop = true;
ObjectRepresentationPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
ObjectRepresentationPanel.Controls.Add(EntityPictureBox);
ObjectRepresentationPanel.Controls.Add(AdditionalColorLabel);
ObjectRepresentationPanel.Controls.Add(ColorLabel);
ObjectRepresentationPanel.Location = new Point(582, 12);
ObjectRepresentationPanel.Name = "ObjectRepresentationPanel";
ObjectRepresentationPanel.Size = new Size(311, 307);
ObjectRepresentationPanel.TabIndex = 1;
ObjectRepresentationPanel.DragDrop += PanelObject_DragDrop;
ObjectRepresentationPanel.DragEnter += PanelObject_DragEnter;
//
// EntityPictureBox
//
EntityPictureBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
EntityPictureBox.Location = new Point(13, 52);
EntityPictureBox.Name = "EntityPictureBox";
EntityPictureBox.Size = new Size(283, 252);
EntityPictureBox.TabIndex = 2;
EntityPictureBox.TabStop = false;
//
// AdditionalColorLabel
//
AdditionalColorLabel.AllowDrop = true;
AdditionalColorLabel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
AdditionalColorLabel.BorderStyle = BorderStyle.FixedSingle;
AdditionalColorLabel.Location = new Point(180, 12);
AdditionalColorLabel.Name = "AdditionalColorLabel";
AdditionalColorLabel.Size = new Size(115, 35);
AdditionalColorLabel.TabIndex = 1;
AdditionalColorLabel.Text = "Доп цвет";
AdditionalColorLabel.TextAlign = ContentAlignment.MiddleCenter;
AdditionalColorLabel.DragDrop += LabelAdditionalColor_DragDrop;
AdditionalColorLabel.DragEnter += LabelColor_DragEnter;
//
// ColorLabel
//
ColorLabel.AllowDrop = true;
ColorLabel.BorderStyle = BorderStyle.FixedSingle;
ColorLabel.Location = new Point(13, 12);
ColorLabel.Name = "ColorLabel";
ColorLabel.Size = new Size(115, 35);
ColorLabel.TabIndex = 0;
ColorLabel.Text = "Цвет";
ColorLabel.TextAlign = ContentAlignment.MiddleCenter;
ColorLabel.DragDrop += LabelBaseColor_DragDrop;
ColorLabel.DragEnter += LabelColor_DragEnter;
//
// AddButton
//
AddButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
AddButton.Location = new Point(607, 325);
AddButton.Name = "AddButton";
AddButton.Size = new Size(104, 30);
AddButton.TabIndex = 2;
AddButton.Text = "Добавить";
AddButton.UseVisualStyleBackColor = true;
AddButton.Click += OkButtonClick;
//
// ConfigCancelButton
//
ConfigCancelButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
ConfigCancelButton.Location = new Point(764, 325);
ConfigCancelButton.Name = "ConfigCancelButton";
ConfigCancelButton.Size = new Size(100, 30);
ConfigCancelButton.TabIndex = 3;
ConfigCancelButton.Text = "Отмена";
ConfigCancelButton.UseVisualStyleBackColor = true;
//
// FormBomberConfig
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(905, 367);
Controls.Add(ConfigCancelButton);
Controls.Add(AddButton);
Controls.Add(ObjectRepresentationPanel);
Controls.Add(ParamsGroupBox);
Name = "FormBomberConfig";
Text = "Создание объекта";
ParamsGroupBox.ResumeLayout(false);
ParamsGroupBox.PerformLayout();
ColorsGroupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)WeightNumericUpDown).EndInit();
((System.ComponentModel.ISupportInitialize)SpeedNumericUpDown).EndInit();
ObjectRepresentationPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)EntityPictureBox).EndInit();
ResumeLayout(false);
}
#endregion
private GroupBox ParamsGroupBox;
private GroupBox ColorsGroupBox;
private Panel RedPanel;
private CheckBox FuelTanksCheckbox;
private CheckBox BombsCheckBox;
private NumericUpDown WeightNumericUpDown;
private NumericUpDown SpeedNumericUpDown;
private Label WeightLabel;
private Label SpeedLabel;
private Panel ObjectRepresentationPanel;
private PictureBox EntityPictureBox;
private Label AdditionalColorLabel;
private Label ColorLabel;
private Button AddButton;
private Panel OrangePanel;
private Panel BluePanel;
private Panel GreenPanel;
private Label AdvancedEntityLabel;
private Label BaseEntityLabel;
private Panel VioletPanel;
private Panel BlackPanel;
private Panel GrayPanel;
private Panel WhitePanel;
private Button ConfigCancelButton;
}
}

View File

@ -0,0 +1,124 @@
using AirBomber.Rendering;
namespace AirBomber
{
public partial class FormBomberConfig : Form
{
BomberRendererBase? _renderer = null;
private event Action<BomberRendererBase>? OnBomberAdded;
public FormBomberConfig()
{
InitializeComponent();
RedPanel.MouseDown += PanelColor_MouseDown;
GreenPanel.MouseDown += PanelColor_MouseDown;
BluePanel.MouseDown += PanelColor_MouseDown;
OrangePanel.MouseDown += PanelColor_MouseDown;
WhitePanel.MouseDown += PanelColor_MouseDown;
GrayPanel.MouseDown += PanelColor_MouseDown;
BlackPanel.MouseDown += PanelColor_MouseDown;
VioletPanel.MouseDown += PanelColor_MouseDown;
ConfigCancelButton.Click += (sender, e) => { Close(); };
}
private void DrawBomber()
{
Bitmap bmp = new Bitmap(EntityPictureBox.Width, EntityPictureBox.Height);
Graphics g = Graphics.FromImage(bmp);
_renderer?.SetPosition(5, 5);
_renderer?.DrawEntity(g);
EntityPictureBox.Image = bmp;
}
public void AddEvent(Action<BomberRendererBase> ev)
{
if (OnBomberAdded is null)
OnBomberAdded = ev;
else
OnBomberAdded += ev;
}
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
{
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
}
private void PanelColor_MouseDown(object? sender, MouseEventArgs e)
{
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
}
private void PanelObject_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}
private void LabelColor_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent("System.Drawing.Color") ?? false)
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}
private void PanelObject_DragDrop(object sender, DragEventArgs e)
{
switch (e.Data?.GetData(DataFormats.Text).ToString())
{
case "BaseEntityLabel":
_renderer = new BomberRendererBase(
(int)SpeedNumericUpDown.Value,
(int)WeightNumericUpDown.Value,
Color.White,
EntityPictureBox.Width, EntityPictureBox.Height
);
break;
case "AdvancedEntityLabel":
_renderer = new BomberRenderer(
(int)SpeedNumericUpDown.Value,
(int)WeightNumericUpDown.Value,
Color.White, Color.Black,
FuelTanksCheckbox.Checked,
BombsCheckBox.Checked,
EntityPictureBox.Width, EntityPictureBox.Height
);
break;
}
DrawBomber();
}
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
{
Color SelectedColor = (Color)e.Data?.GetData("System.Drawing.Color")!;
_renderer?.SetBaseColor(SelectedColor);
DrawBomber();
}
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
{
Color SelectedColor = (Color)e.Data?.GetData("System.Drawing.Color")!;
(_renderer as BomberRenderer)?.SetAdditionalColor(SelectedColor);
DrawBomber();
}
private void OkButtonClick(object sender, EventArgs e)
{
if (_renderer is not null)
OnBomberAdded?.Invoke(_renderer);
Close();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -30,7 +30,7 @@
{
CollectionPictureBox = new PictureBox();
ToolGroupBox = new GroupBox();
groupBox1 = new GroupBox();
SetsGroupBox = new GroupBox();
SetNameTextBox = new TextBox();
StorageListBox = new ListBox();
AddSetButton = new Button();
@ -41,7 +41,7 @@
AddBomberButton = new Button();
((System.ComponentModel.ISupportInitialize)CollectionPictureBox).BeginInit();
ToolGroupBox.SuspendLayout();
groupBox1.SuspendLayout();
SetsGroupBox.SuspendLayout();
SuspendLayout();
//
// CollectionPictureBox
@ -56,7 +56,7 @@
// ToolGroupBox
//
ToolGroupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
ToolGroupBox.Controls.Add(groupBox1);
ToolGroupBox.Controls.Add(SetsGroupBox);
ToolGroupBox.Controls.Add(RefreshCollectionButton);
ToolGroupBox.Controls.Add(RemoveBomberButton);
ToolGroupBox.Controls.Add(NumberMaskedTextBox);
@ -68,18 +68,18 @@
ToolGroupBox.TabStop = false;
ToolGroupBox.Text = "Инструменты";
//
// groupBox1
// SetsGroupBox
//
groupBox1.Controls.Add(SetNameTextBox);
groupBox1.Controls.Add(StorageListBox);
groupBox1.Controls.Add(AddSetButton);
groupBox1.Controls.Add(RemoveSetButton);
groupBox1.Location = new Point(6, 22);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(164, 232);
groupBox1.TabIndex = 8;
groupBox1.TabStop = false;
groupBox1.Text = "Наборы";
SetsGroupBox.Controls.Add(SetNameTextBox);
SetsGroupBox.Controls.Add(StorageListBox);
SetsGroupBox.Controls.Add(AddSetButton);
SetsGroupBox.Controls.Add(RemoveSetButton);
SetsGroupBox.Location = new Point(6, 22);
SetsGroupBox.Name = "SetsGroupBox";
SetsGroupBox.Size = new Size(164, 232);
SetsGroupBox.TabIndex = 8;
SetsGroupBox.TabStop = false;
SetsGroupBox.Text = "Наборы";
//
// SetNameTextBox
//
@ -170,8 +170,8 @@
((System.ComponentModel.ISupportInitialize)CollectionPictureBox).EndInit();
ToolGroupBox.ResumeLayout(false);
ToolGroupBox.PerformLayout();
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
SetsGroupBox.ResumeLayout(false);
SetsGroupBox.PerformLayout();
ResumeLayout(false);
}
@ -183,7 +183,7 @@
private Button RemoveBomberButton;
private MaskedTextBox NumberMaskedTextBox;
private Button AddBomberButton;
private GroupBox groupBox1;
private GroupBox SetsGroupBox;
private TextBox SetNameTextBox;
private ListBox StorageListBox;
private Button AddSetButton;

View File

@ -1,4 +1,5 @@
using AirBomber.Generics;
using AirBomber.Rendering;
namespace AirBomber
{
@ -33,15 +34,19 @@ namespace AirBomber
if (StorageListBox.SelectedIndex == -1)
return;
FormBomberConfig ConfigForm = new FormBomberConfig();
ConfigForm.AddEvent(OnEntityAdded);
ConfigForm.Show();
}
public void OnEntityAdded(BomberRendererBase Renderer)
{
var obj = _storage[StorageListBox.SelectedItem.ToString() ?? string.Empty];
if (obj is null)
return;
BomberForm Form = new BomberForm();
if (Form.ShowDialog() == DialogResult.OK)
{
if (obj + Form.SelectedRenderer != -1)
if (obj + (Renderer) != -1)
{
MessageBox.Show("Объект добавлен");
CollectionPictureBox.Image = obj.ShowEntities();
@ -52,7 +57,6 @@ namespace AirBomber
MessageBox.Show("Не удалось добавить объект");
}
}
}
public void ButtonRemoveEntity_Click(object sender, EventArgs e)
{

View File

@ -1,4 +1,64 @@
<root>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">

View File

@ -51,5 +51,11 @@ namespace AirBomber.Rendering
g.FillEllipse(AdditionalBrush, new Rectangle(RightBombStartXY, RightBombSize));
}
}
public void SetAdditionalColor(Color AdditionalColor)
{
if (EntityBomber is BomberEntity AdvancedBomber)
AdvancedBomber.SetAdditionalColor(AdditionalColor);
}
}
}

View File

@ -59,16 +59,10 @@ namespace AirBomber.Rendering
if (x < 0)
x = 0;
else if (x + _bomberWidth > _pictureWidth)
x = _pictureWidth - _bomberWidth;
_startPosX = x;
if (y < 0)
y = 0;
else if (y + _bomberHeight > _pictureHeight)
y = _pictureHeight - _bomberHeight;
_startPosY = y;
}
@ -169,5 +163,10 @@ namespace AirBomber.Rendering
};
g.DrawPolygon(Pen, BackRightWing);
}
public void SetBaseColor(Color BaseColor)
{
EntityBomber?.SetBaseColor(BaseColor);
}
}
}