Merge pull request #41 from IngenerkaTeamCenter/Arsenee-patch-1

Чинил мультик с движением прямо
This commit is contained in:
Mikhail Abramov 2018-04-14 20:31:15 +03:00 committed by GitHub
commit 68cbc73340
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 10 deletions

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

@ -342,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
@ -412,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();

View file

@ -22,6 +22,11 @@ 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;
@ -173,6 +178,20 @@ namespace WindowsFormsApplication1
persons[nomerPersa].charname = charNameBox.Text; persons[nomerPersa].charname = charNameBox.Text;
persons[nomerPersa].l2.Text = 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;
openSpace.Image = null; openSpace.Image = null;
@ -186,19 +205,37 @@ 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[] coordinatyNachala = TextBoxWall1.Text.Split(new String[] { "," }, StringSplitOptions.None);
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].charname = charNameBox.Text;
persons[pNomer].l2.Text = charNameBox.Text; persons[pNomer].l2.Text = charNameBox.Text;
} }
String[] arr = TextBoxWall1.Text.Split(new String[] { " " }, StringSplitOptions.None); //sohranit v massiv
//MessageBox.Show(arr[0]); //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);
} }
@ -212,7 +249,6 @@ namespace WindowsFormsApplication1
File.AppendAllText(filename, " " + name + ".nomer_kadra = 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, Environment.NewLine); File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
} }
@ -250,8 +286,7 @@ namespace WindowsFormsApplication1
if (ComboBoxMove.Text == "Прямо") if (ComboBoxMove.Text == "Прямо")
{ {
Sinus.CreatePerson(filename, "per", TextBoxWall1.Text); old_place(filename, "per", persons[nomerPersa-1]);
old_place(filename, "per");
Files.OpenWhile(filename); Files.OpenWhile(filename);
go_pryamo(filename, "per"); go_pryamo(filename, "per");
close_while(filename); close_while(filename);
@ -276,7 +311,7 @@ namespace WindowsFormsApplication1
else if (ComboBoxMove.Text == "Диагонально") else if (ComboBoxMove.Text == "Диагонально")
{ {
Sinus.CreatePerson(filename, "per", TextBoxWall1.Text); Sinus.CreatePerson(filename, "per", TextBoxWall1.Text);
old_place(filename, "per"); old_place(filename, "per", persons[nomerPersa - 1]);
Files.OpenWhile(filename); Files.OpenWhile(filename);
go_pryamo(filename, "per"); go_pryamo(filename, "per");
close_while(filename); close_while(filename);
@ -321,6 +356,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);
} }
} }
} }
@ -348,10 +388,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)
{
}
} }
} }