From a242cd72cfbe91bae80d8fee51264d4b9d0771a9 Mon Sep 17 00:00:00 2001 From: Voltronormu Date: Fri, 13 Apr 2018 16:33:35 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BF=D0=B5=D1=80=D1=81=D0=BE=D0=B2.=20=D0=9F=D0=BE?= =?UTF-8?q?=D0=B4=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BB=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87?= =?UTF-8?q?=D1=83=20Circle.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WindowsFormsApplication1/Circle.cs | 49 +++++++++++++++++++ .../MainForm.Designer.cs | 44 ++++++++++++----- .../WindowsFormsApplication1/MainForm.cs | 43 +++------------- .../WindowsFormsApplication1.csproj | 1 + 4 files changed, 91 insertions(+), 46 deletions(-) create mode 100644 WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs b/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs new file mode 100644 index 0000000..3e254d9 --- /dev/null +++ b/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WindowsFormsApplication1 +{ + public class Circle + { + + public static void CreatePerson(string filename, string name) + { + File.AppendAllText(filename, " Person " + name + ";" + Environment.NewLine); + File.AppendAllText(filename, Environment.NewLine); + File.AppendAllText(filename, " " + name + ".texture = txLoadImage(\"Pictures\\\\Personaj.bmp\");" + Environment.NewLine); + File.AppendAllText(filename, Environment.NewLine); + File.AppendAllText(filename, " " + name + ".x = 50;" + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".y = 50;" + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".angle = 0;" + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".nomer_kadra = 0;" + Environment.NewLine); + File.AppendAllText(filename, Environment.NewLine); + } + + public static void circle(string filename, string name) + { + File.AppendAllText(filename, " angle++;" + Environment.NewLine); + File.AppendAllText(filename, " textureX = 500 + 200 * cos (angle / 10);" + Environment.NewLine); + File.AppendAllText(filename, " textureY = 300 + 200 * sin (angle / 10);" + Environment.NewLine); + File.AppendAllText(filename, " txTransparentBlt(txDC(), textureX, textureY, 55, 86, texture, 55 * nomer_kadra, 0, RGB(0, 255, 255));" + Environment.NewLine); + File.AppendAllText(filename, Environment.NewLine); + File.AppendAllText(filename, " nomer_kadra++;" + Environment.NewLine); + File.AppendAllText(filename, Environment.NewLine); + File.AppendAllText(filename, " if (nomer_kadra > 2)" + Environment.NewLine); + File.AppendAllText(filename, " {" + Environment.NewLine); + File.AppendAllText(filename, " nomer_kadra = 0;" + Environment.NewLine); + File.AppendAllText(filename, " }" + Environment.NewLine); + File.AppendAllText(filename, Environment.NewLine); + File.AppendAllText(filename, " txSleep(10);" + Environment.NewLine); + File.AppendAllText(filename, " }" + Environment.NewLine); + File.AppendAllText(filename, Environment.NewLine); + File.AppendAllText(filename, "txDeleteDC(texture);" + Environment.NewLine); + File.AppendAllText(filename, Environment.NewLine); + File.AppendAllText(filename, "return 0;" + Environment.NewLine); + File.AppendAllText(filename, "}" + Environment.NewLine); + } + } +} diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs index fc6b1bd..9e44e67 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs @@ -33,6 +33,7 @@ namespace WindowsFormsApplication1 this.LabelName = new System.Windows.Forms.Label(); this.nazvanieTextBox = new System.Windows.Forms.TextBox(); this.panel1 = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.PictureBoxBackground = new System.Windows.Forms.PictureBox(); this.LabelBackground = new System.Windows.Forms.Label(); @@ -41,6 +42,8 @@ namespace WindowsFormsApplication1 this.panel2 = new System.Windows.Forms.Panel(); this.SaveCharButton = new System.Windows.Forms.Button(); this.panel3 = new System.Windows.Forms.Panel(); + this.charNameBox = new System.Windows.Forms.TextBox(); + this.charNameLabel = new System.Windows.Forms.Label(); this.openSpace = new System.Windows.Forms.PictureBox(); this.SpriteNumberLabel = new System.Windows.Forms.Label(); this.SpriteNumberTextBox = new System.Windows.Forms.TextBox(); @@ -60,7 +63,6 @@ namespace WindowsFormsApplication1 this.ButtonAddChar = new System.Windows.Forms.Button(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); - this.label1 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).BeginInit(); this.panel2.SuspendLayout(); @@ -120,6 +122,16 @@ namespace WindowsFormsApplication1 this.panel1.Size = new System.Drawing.Size(297, 380); this.panel1.TabIndex = 4; // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(14, 274); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(259, 13); + this.label1.TabIndex = 24; + this.label1.Text = "number name state view delete"; + this.label1.Click += new System.EventHandler(this.label1_Click); + // // label13 // this.label13.AutoSize = true; @@ -191,6 +203,8 @@ namespace WindowsFormsApplication1 // // panel3 // + this.panel3.Controls.Add(this.charNameBox); + this.panel3.Controls.Add(this.charNameLabel); this.panel3.Controls.Add(this.openSpace); this.panel3.Controls.Add(this.SpriteNumberLabel); this.panel3.Controls.Add(this.SpriteNumberTextBox); @@ -213,6 +227,22 @@ namespace WindowsFormsApplication1 this.panel3.TabIndex = 2; this.panel3.Visible = false; // + // charNameBox + // + this.charNameBox.Location = new System.Drawing.Point(85, 115); + this.charNameBox.Name = "charNameBox"; + this.charNameBox.Size = new System.Drawing.Size(138, 20); + this.charNameBox.TabIndex = 19; + // + // charNameLabel + // + this.charNameLabel.AutoSize = true; + this.charNameLabel.Location = new System.Drawing.Point(19, 115); + this.charNameLabel.Name = "charNameLabel"; + this.charNameLabel.Size = new System.Drawing.Size(60, 13); + this.charNameLabel.TabIndex = 18; + this.charNameLabel.Text = "Название:"; + // // openSpace // this.openSpace.Location = new System.Drawing.Point(65, 206); @@ -371,16 +401,6 @@ namespace WindowsFormsApplication1 // this.openFileDialog1.FileName = "openFileDialog1"; // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(14, 274); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(259, 13); - this.label1.TabIndex = 24; - this.label1.Text = "number name state view delete"; - this.label1.Click += new System.EventHandler(this.label1_Click); - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -438,5 +458,7 @@ namespace WindowsFormsApplication1 private System.Windows.Forms.Label label13; private System.Windows.Forms.PictureBox openSpace; private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox charNameBox; + private System.Windows.Forms.Label charNameLabel; } } \ No newline at end of file diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs index 3b22819..3b95200 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs @@ -27,6 +27,7 @@ namespace WindowsFormsApplication1 public String time2; public String sprite; public String moveside; + public String charname; }; Person[] persons = new Person[200]; @@ -169,6 +170,8 @@ namespace WindowsFormsApplication1 persons[nomerPersa].sprite = SpriteNumberTextBox.Text; persons[nomerPersa].moveside = ComboBoxMove.Text; persons[nomerPersa].nomer = nomerPersa; + persons[nomerPersa].charname = charNameBox.Text; + persons[nomerPersa].l2.Text = charNameBox.Text; nomerPersa++; yPersa = yPersa + 30; @@ -183,23 +186,14 @@ namespace WindowsFormsApplication1 persons[pNomer].sprite = SpriteNumberTextBox.Text; persons[pNomer].moveside = ComboBoxMove.Text; persons[pNomer].nomer = pNomer; + persons[pNomer].charname = charNameBox.Text; + persons[pNomer].l2.Text = charNameBox.Text; } String[] arr = TextBoxWall1.Text.Split(new String[] { " " }, StringSplitOptions.None); //MessageBox.Show(arr[0]); } - private void circle_create_person(string filename, string name) - { - File.AppendAllText(filename, " HDC texture = txLoadImage(\"Pictures\\Personaj.bmp);" + Environment.NewLine); - File.AppendAllText(filename, Environment.NewLine); - File.AppendAllText(filename, " double textureX = 50;"+ Environment.NewLine); - File.AppendAllText(filename, " double textureY = 50;"+ Environment.NewLine); - File.AppendAllText(filename, " double angle = 0;"+ Environment.NewLine); - File.AppendAllText(filename, " double nomer_kadra = 0;"+ Environment.NewLine); - File.AppendAllText(filename, Environment.NewLine); - } - private void old_place(string filename, string name) { File.AppendAllText(filename, " " + name + ".x = " + TextBoxWall1.Text + "; " + Environment.NewLine); @@ -221,28 +215,6 @@ namespace WindowsFormsApplication1 File.AppendAllText(filename, " }" + Environment.NewLine); } - private void circle(string filename, string name) - { - File.AppendAllText(filename, " angle++;"+ Environment.NewLine); - File.AppendAllText(filename, " textureX = 500 + 200 * cos (angle / 10);"+ Environment.NewLine); - File.AppendAllText(filename, " textureY = 300 + 200 * sin (angle / 10);"+ Environment.NewLine); - File.AppendAllText(filename, " txTransparentBlt(txDC(), textureX, textureY, 55, 86, texture, 55 * nomer_kadra, 0, RGB(0, 255, 255));"+ Environment.NewLine); - File.AppendAllText(filename, Environment.NewLine); - File.AppendAllText(filename, " nomer_kadra++;"+ Environment.NewLine); - File.AppendAllText(filename, Environment.NewLine); - File.AppendAllText(filename, " if (nomer_kadra > 2)"+ Environment.NewLine); - File.AppendAllText(filename, " {"+ Environment.NewLine); - File.AppendAllText(filename, " nomer_kadra = 0;"+ Environment.NewLine); - File.AppendAllText(filename, " }"+ Environment.NewLine); - File.AppendAllText(filename, Environment.NewLine); - File.AppendAllText(filename, " txSleep(10);"+ Environment.NewLine); - File.AppendAllText(filename, " }"+ Environment.NewLine); - File.AppendAllText(filename, Environment.NewLine); - File.AppendAllText(filename, "txDeleteDC(texture);"+ Environment.NewLine); - File.AppendAllText(filename, Environment.NewLine); - File.AppendAllText(filename, "return 0;"+ Environment.NewLine); - File.AppendAllText(filename, "}"+ Environment.NewLine); - } private void OpenAddCharClick(object sender, EventArgs e) { @@ -295,9 +267,9 @@ namespace WindowsFormsApplication1 } else if (ComboBoxMove.Text == "Кругами") { - circle_create_person(filename, "per"); + Circle.CreatePerson(filename, "per"); Files.OpenWhile(filename); - circle(filename, "per"); + Circle.circle(filename, "per"); close_while(filename); delete_pics(filename); } @@ -339,6 +311,7 @@ namespace WindowsFormsApplication1 SpriteNumberTextBox.Text = persons[nomer].sprite; ComboBoxMove.Text = persons[nomer].moveside; pNomer = persons[nomer].nomer; + charNameBox.Text = persons[nomer].charname; if (!String.IsNullOrEmpty(persons[nomer].adress)) { diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/WindowsFormsApplication1.csproj b/WindowsFormsApplication1/WindowsFormsApplication1/WindowsFormsApplication1.csproj index 7275eed..704c138 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/WindowsFormsApplication1.csproj +++ b/WindowsFormsApplication1/WindowsFormsApplication1/WindowsFormsApplication1.csproj @@ -48,6 +48,7 @@ + Form