private void mnuChangeLocationStructure_Click(object sender, RoutedEventArgs e) { if (dgStructures.SelectedItem != null) { var structure = ((data.StructureInfo)dgStructures.SelectedItem); var oldPlayfield = structure.playfield; windows.ChangeLocation wdChangeLocation = new windows.ChangeLocation(); wdChangeLocation.DataContext = structure; if (wdChangeLocation.ShowDialog() == true) { if (structure.playfield != oldPlayfield) { Entity_ChangePlayfield(structure.id, structure.playfield, structure.pos.ToPVector3(), structure.rot.ToPVector3()); } else { Entity_SetPosition(structure.id, structure.pos.ToPVector3(), structure.rot.ToPVector3()); } } } }
private void mnuChangeLocationPlayer_Click(object sender, RoutedEventArgs e) { if (dgPlayer.SelectedItem != null) { var player = ((data.PlayerInfo)dgPlayer.SelectedItem); var oldPlayfield = player.playfield; windows.ChangeLocation wdChangeLocation = new windows.ChangeLocation { DataContext = player }; if (wdChangeLocation.ShowDialog() == true) { if (player.playfield != oldPlayfield) { Player_ChangePlayerfield(player.entityId, player.playfield, player.pos.ToPVector3(), player.rot.ToPVector3()); } else { Entity_SetPosition(player.entityId, player.pos.ToPVector3(), player.rot.ToPVector3()); } } } }