-
Notifications
You must be signed in to change notification settings - Fork 2
/
ModifySpawn.cs
63 lines (50 loc) · 1.61 KB
/
ModifySpawn.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Windows.Forms;
namespace Region_Editor
{
public partial class ModifySpawn : Form
{
public bool Canceled = false;
public Spawn Spawn = new Spawn();
public ModifySpawn()
{
InitializeComponent();
}
public void Initialize(Spawn spawn)
{
Spawn = spawn;
id.Text = spawn.SpawnID.ToString();
type.Text = spawn.SpawnType;
min.Text = spawn.SpawnMinSeconds.ToString();
max.Text = spawn.SpawnMaxSeconds.ToString();
amount.Text = spawn.SpawnAmount.ToString();
}
private void setButton_Click(object sender, EventArgs e)
{
if (id.Text == "" || type.Text == "" || min.Text == "" || max.Text == "" || amount.Text == "")
{
MessageBox.Show("All fields must to completed before saving.");
return;
}
int _id;
int _min;
int _max;
int _amount;
try { _id = Convert.ToInt32(id.Text); }
catch { _id = 0; }
try { _min = Convert.ToInt32(min.Text); }
catch { _min = 0; }
try { _max = Convert.ToInt32(max.Text); }
catch { _max = 0; }
try { _amount = Convert.ToInt32(amount.Text); }
catch { _amount = 0; }
Spawn = new Spawn(_id, type.Text, _min, _max, _amount);
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
Canceled = true;
Close();
}
}
}