private void btnAdd_Click(object sender, EventArgs e) { EntryPoint ent = new EntryPoint(txtName.Text, (int)numX.Value, (int)numY.Value); ent.MapName = cmbMap.Text; EntryPoints.Add(ent); pctTownMap.Refresh(); }
private void pctTownMap_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { SelectedEntryPoint = null; txtName.Text = ""; cmbMap.SelectedIndex = -1; numX.Value = 0; numY.Value = 0; pctTownMap.Refresh(); } if (e.Button != MouseButtons.Left) return; foreach (EntryPoint ent in EntryPoints) { if ((e.X >= ent.X && e.X <= ent.X + 25) && e.Y >= ent.Y && e.Y <= ent.Y + 13) { SelectedEntryPoint = ent; for (int i = 0; i < cmbMap.Items.Count; i++) if ((string)cmbMap.Items[i] == ent.MapName) cmbMap.SelectedIndex = i; txtName.Text = ent.Name; numEntire.Value = ent.Entire; numX.Value = ent.X; numY.Value = ent.Y; pctTownMap.Refresh(); IsDragging = true; return; } } }
private EntryPoint ParseEntryPoint(Location Loc, int i) { var ent = new EntryPoint(); ent.Name = GetMSGValue((((Loc.Pid) + 100)*1000) + 100 + (i*10) + 1); string Txt = GetMSGValue((((Loc.Pid) + 100)*1000) + 100 + (i*10) + 2); if (!string.IsNullOrEmpty(Txt)) ent.X = Int32.Parse(Txt); Txt = GetMSGValue((((Loc.Pid) + 100)*1000) + 100 + (i*10) + 3); if (!string.IsNullOrEmpty(Txt)) ent.Y = Int32.Parse(Txt); if (Loc.EntryPoints == null) Loc.EntryPoints = new List<EntryPoint>(); return ent; }