internal void updateVals(ObjectData fob) { if (fob == null || fob.selected == null || fob.std == null) { return; } RoboCup.Objects.MovingObject obj = null; if (fob.selected[0] == 'B') { int id = int.Parse(fob.selected.Split(' ')[1]); obj = fob.std.Balls.Find(b => b.Id == id); } else { string[] split = fob.selected.Split(' '); string team = split[1]; int unum = int.Parse(split[2]); obj = fob.std.Players.Find(p => p.Unum == unum && p.Team == team); } if (obj == null) { return; } fob.label6.Text = obj.currentPosition.X.ToString("0.00"); fob.label7.Text = obj.currentPosition.Y.ToString("0.00"); fob.label8.Text = obj.objectVelocity.X.ToString("0.00"); fob.label9.Text = obj.objectVelocity.Y.ToString("0.00"); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { ComboBox combo = sender as ComboBox; selected = combo.SelectedItem as string; RoboCup.Objects.MovingObject obj = null; if (selected[0] == 'B') { int id = int.Parse(selected.Split(' ')[1]); obj = std.Balls.Find(b => b.Id == id); } else { string[] split = selected.Split(' '); string team = split[1]; int unum = int.Parse(split[2]); obj = std.Players.Find(p => p.Unum == unum && p.Team == team); } label6.Text = obj.currentPosition.X.ToString("0.00"); label7.Text = obj.currentPosition.Y.ToString("0.00"); label8.Text = obj.objectVelocity.X.ToString("0.00"); label9.Text = obj.objectVelocity.Y.ToString("0.00"); }