Merge branch 'master' into AnfimovS-patch-1

This commit is contained in:
Mikhail Abramov 2018-04-14 20:36:02 +03:00 committed by GitHub
commit c4670fbb2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 160 additions and 28 deletions

BIN
How to use.docx Normal file

Binary file not shown.

View file

@ -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);
}
}
}

View file

@ -15,7 +15,9 @@ namespace WindowsFormsApplication1
File.AppendAllText(filename, "struct Person" + Environment.NewLine); File.AppendAllText(filename, "struct Person" + Environment.NewLine);
File.AppendAllText(filename, "{" + Environment.NewLine); File.AppendAllText(filename, "{" + Environment.NewLine);
File.AppendAllText(filename, " double x;" + Environment.NewLine); File.AppendAllText(filename, " double x;" + Environment.NewLine);
File.AppendAllText(filename, " double x2;" + Environment.NewLine);
File.AppendAllText(filename, " double y;" + Environment.NewLine); File.AppendAllText(filename, " double y;" + Environment.NewLine);
File.AppendAllText(filename, " double y2;" + Environment.NewLine);
File.AppendAllText(filename, " double angle;" + Environment.NewLine); File.AppendAllText(filename, " double angle;" + Environment.NewLine);
File.AppendAllText(filename, " double nomer_kadra;" + Environment.NewLine); File.AppendAllText(filename, " double nomer_kadra;" + Environment.NewLine);
File.AppendAllText(filename, " HDC texture;" + Environment.NewLine); File.AppendAllText(filename, " HDC texture;" + Environment.NewLine);

View file

@ -33,6 +33,7 @@ namespace WindowsFormsApplication1
this.LabelName = new System.Windows.Forms.Label(); this.LabelName = new System.Windows.Forms.Label();
this.nazvanieTextBox = new System.Windows.Forms.TextBox(); this.nazvanieTextBox = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label();
this.PictureBoxBackground = new System.Windows.Forms.PictureBox(); this.PictureBoxBackground = new System.Windows.Forms.PictureBox();
this.LabelBackground = new System.Windows.Forms.Label(); this.LabelBackground = new System.Windows.Forms.Label();
@ -41,6 +42,8 @@ namespace WindowsFormsApplication1
this.panel2 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel();
this.SaveCharButton = new System.Windows.Forms.Button(); this.SaveCharButton = new System.Windows.Forms.Button();
this.panel3 = new System.Windows.Forms.Panel(); 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.openSpace = new System.Windows.Forms.PictureBox();
this.SpriteNumberLabel = new System.Windows.Forms.Label(); this.SpriteNumberLabel = new System.Windows.Forms.Label();
this.SpriteNumberTextBox = new System.Windows.Forms.TextBox(); this.SpriteNumberTextBox = new System.Windows.Forms.TextBox();
@ -60,7 +63,6 @@ namespace WindowsFormsApplication1
this.ButtonAddChar = new System.Windows.Forms.Button(); this.ButtonAddChar = new System.Windows.Forms.Button();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.label1 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).BeginInit();
this.panel2.SuspendLayout(); this.panel2.SuspendLayout();
@ -120,6 +122,16 @@ namespace WindowsFormsApplication1
this.panel1.Size = new System.Drawing.Size(297, 380); this.panel1.Size = new System.Drawing.Size(297, 380);
this.panel1.TabIndex = 4; 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 // label13
// //
this.label13.AutoSize = true; this.label13.AutoSize = true;
@ -191,6 +203,8 @@ namespace WindowsFormsApplication1
// //
// panel3 // panel3
// //
this.panel3.Controls.Add(this.charNameBox);
this.panel3.Controls.Add(this.charNameLabel);
this.panel3.Controls.Add(this.openSpace); this.panel3.Controls.Add(this.openSpace);
this.panel3.Controls.Add(this.SpriteNumberLabel); this.panel3.Controls.Add(this.SpriteNumberLabel);
this.panel3.Controls.Add(this.SpriteNumberTextBox); this.panel3.Controls.Add(this.SpriteNumberTextBox);
@ -213,6 +227,22 @@ namespace WindowsFormsApplication1
this.panel3.TabIndex = 2; this.panel3.TabIndex = 2;
this.panel3.Visible = false; 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 // openSpace
// //
this.openSpace.Location = new System.Drawing.Point(65, 206); this.openSpace.Location = new System.Drawing.Point(65, 206);
@ -312,6 +342,7 @@ namespace WindowsFormsApplication1
this.TextBoxWall2.Name = "TextBoxWall2"; this.TextBoxWall2.Name = "TextBoxWall2";
this.TextBoxWall2.Size = new System.Drawing.Size(100, 20); this.TextBoxWall2.Size = new System.Drawing.Size(100, 20);
this.TextBoxWall2.TabIndex = 3; this.TextBoxWall2.TabIndex = 3;
this.TextBoxWall2.TextChanged += new System.EventHandler(this.TextBoxWall2_TextChanged);
this.TextBoxWall2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxWall1_KeyPress); this.TextBoxWall2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxWall1_KeyPress);
// //
// TextBoxWall1 // TextBoxWall1
@ -371,16 +402,6 @@ namespace WindowsFormsApplication1
// //
this.openFileDialog1.FileName = "openFileDialog1"; 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 // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -392,6 +413,7 @@ namespace WindowsFormsApplication1
this.Name = "MainForm"; this.Name = "MainForm";
this.RightToLeftLayout = true; this.RightToLeftLayout = true;
this.Text = "Свойства персонажа"; this.Text = "Свойства персонажа";
this.Load += new System.EventHandler(this.MainForm_Load);
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel1.PerformLayout(); this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).EndInit();
@ -438,5 +460,7 @@ namespace WindowsFormsApplication1
private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label13;
private System.Windows.Forms.PictureBox openSpace; private System.Windows.Forms.PictureBox openSpace;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox charNameBox;
private System.Windows.Forms.Label charNameLabel;
} }
} }

View file

@ -22,11 +22,17 @@ namespace WindowsFormsApplication1
public int nomer; public int nomer;
public String coord; public String coord;
public String coord2; public String coord2;
//Dobavit polya
public String x1;
public String y1;
public String x2;
public String y2;
public String adress; public String adress;
public String time1; public String time1;
public String time2; public String time2;
public String sprite; public String sprite;
public String moveside; public String moveside;
public String charname;
}; };
Person[] persons = new Person[200]; Person[] persons = new Person[200];
@ -169,6 +175,22 @@ namespace WindowsFormsApplication1
persons[nomerPersa].sprite = SpriteNumberTextBox.Text; persons[nomerPersa].sprite = SpriteNumberTextBox.Text;
persons[nomerPersa].moveside = ComboBoxMove.Text; persons[nomerPersa].moveside = ComboBoxMove.Text;
persons[nomerPersa].nomer = nomerPersa; persons[nomerPersa].nomer = nomerPersa;
persons[nomerPersa].charname = charNameBox.Text;
persons[nomerPersa].l2.Text = charNameBox.Text;
String[] coordinatyNachala = TextBoxWall1.Text.Split(new String[] { "," }, StringSplitOptions.None);
if (coordinatyNachala.Length > 1)
{
persons[nomerPersa].x1 = coordinatyNachala[0];
persons[nomerPersa].y1 = coordinatyNachala[1];
}
String[] coordinatyKonza = TextBoxWall2.Text.Split(new String[] { "," }, StringSplitOptions.None);
if (coordinatyKonza.Length > 1)
{
persons[nomerPersa].x2 = coordinatyKonza[0];
persons[nomerPersa].y2 = coordinatyKonza[1];
}
nomerPersa++; nomerPersa++;
yPersa = yPersa + 30; yPersa = yPersa + 30;
@ -183,30 +205,49 @@ namespace WindowsFormsApplication1
persons[pNomer].sprite = SpriteNumberTextBox.Text; persons[pNomer].sprite = SpriteNumberTextBox.Text;
persons[pNomer].moveside = ComboBoxMove.Text; persons[pNomer].moveside = ComboBoxMove.Text;
persons[pNomer].nomer = pNomer; persons[pNomer].nomer = pNomer;
}
String[] arr = TextBoxWall1.Text.Split(new String[] { " " }, StringSplitOptions.None); String[] coordinatyNachala = TextBoxWall1.Text.Split(new String[] { "," }, StringSplitOptions.None);
//MessageBox.Show(arr[0]); if (coordinatyNachala.Length > 1)
} {
persons[pNomer].x1 = coordinatyNachala[0];
persons[pNomer].y1 = coordinatyNachala[1];
}
String[] coordinatyKonza = TextBoxWall2.Text.Split(new String[] { "," }, StringSplitOptions.None);
if (coordinatyKonza.Length > 1)
{
persons[pNomer].x2 = coordinatyKonza[0];
persons[pNomer].y2 = coordinatyKonza[1];
}
persons[pNomer].charname = charNameBox.Text;
persons[pNomer].l2.Text = charNameBox.Text;
}
private void circle_create_person(string filename, string name, Person p) private void circle_create_person(string filename, string name, Person p)
{ {
File.AppendAllText(filename, " Person " + name + ";" + Environment.NewLine); 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); 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);
//sohranit v massiv
//proverit, chto est arr[1]
} }
private void old_place(string filename, string name) private void old_place(string filename, string name, Person p)
{ {
File.AppendAllText(filename, " " + name + ".x = " + TextBoxWall1.Text + "; " + Environment.NewLine); //ctrl-c ctrl-v texture n_sprites x2 y2
File.AppendAllText(filename, " " + name + ".y = " + TextBoxWall1.Text + "; " + Environment.NewLine); File.AppendAllText(filename, " Person " + name + ";" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " " + name + ".x = " + p.x1 + "; " + Environment.NewLine);
File.AppendAllText(filename, " " + name + ".y = " + p.y1 + "; " + Environment.NewLine);
File.AppendAllText(filename, " " + name + ".nomer_kadra = 0; " + Environment.NewLine); File.AppendAllText(filename, " " + name + ".nomer_kadra = 0; " + Environment.NewLine);
File.AppendAllText(filename, " " + name + ".texture = txLoadImage(\"Pictures\\\\" + Path.GetFileName(p.adress) + "\"); " + Environment.NewLine);
File.AppendAllText(filename, " " + name + ".gr_dvigx = 1000; " + Environment.NewLine); File.AppendAllText(filename, " " + name + ".gr_dvigx = 1000; " + Environment.NewLine);
} }
@ -267,7 +308,6 @@ namespace WindowsFormsApplication1
{ {
string filename = saveFileDialog1.FileName; string filename = saveFileDialog1.FileName;
//Add TXLib and pics //Add TXLib and pics
File.Copy(Path.Combine(Application.StartupPath, "TXLib.h"), filename.Replace(Path.GetFileName(filename), "TXLib.h"), true); File.Copy(Path.Combine(Application.StartupPath, "TXLib.h"), filename.Replace(Path.GetFileName(filename), "TXLib.h"), true);
string adres_papki = filename.Replace(Path.GetFileName(filename), "Pictures"); string adres_papki = filename.Replace(Path.GetFileName(filename), "Pictures");
@ -346,6 +386,7 @@ namespace WindowsFormsApplication1
SpriteNumberTextBox.Text = persons[nomer].sprite; SpriteNumberTextBox.Text = persons[nomer].sprite;
ComboBoxMove.Text = persons[nomer].moveside; ComboBoxMove.Text = persons[nomer].moveside;
pNomer = persons[nomer].nomer; pNomer = persons[nomer].nomer;
charNameBox.Text = persons[nomer].charname;
if (!String.IsNullOrEmpty(persons[nomer].adress)) if (!String.IsNullOrEmpty(persons[nomer].adress))
{ {
@ -355,6 +396,11 @@ namespace WindowsFormsApplication1
{ {
openSpace.Image = null; openSpace.Image = null;
} }
MessageBox.Show(persons[nomer].x1);
MessageBox.Show(persons[nomer].y1);
MessageBox.Show(persons[nomer].x2);
MessageBox.Show(persons[nomer].y2);
} }
} }
} }
@ -382,10 +428,20 @@ namespace WindowsFormsApplication1
{ {
char c = e.KeyChar; char c = e.KeyChar;
if (!(char.IsDigit(c) || c == '\b' || c == ' ')) if (!(char.IsDigit(c) || c == '\b' || c == ','))
{ {
e.Handled = true; e.Handled = true;
} }
} }
private void MainForm_Load(object sender, EventArgs e)
{
}
private void TextBoxWall2_TextChanged(object sender, EventArgs e)
{
}
} }
} }

View file

@ -48,6 +48,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Circle.cs" />
<Compile Include="Files.cs" /> <Compile Include="Files.cs" />
<Compile Include="MainForm.cs"> <Compile Include="MainForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>