private void onMouseClick(Part p) { if (destinationParts.Contains(p)) { ExperimentStorage es = getTargetForPart(p); if (es != null) { exp.moveTo(es); closeGui(); } } else if (p == sourcePart) { showError("#ne_This_is_the_source_part"); } else { showError("#ne_This_is_an_invalid_part"); } }
void showMoveGui(int id) { GUILayout.BeginVertical(); GUILayout.Label("Choose Target"); moveScrollPos = GUILayout.BeginScrollView(moveScrollPos, GUILayout.Width(180), GUILayout.Height(320)); int i = 0; foreach (ExperimentStorage e in targets) { if (GUILayout.Button(new GUIContent(e.identifier, i.ToString()))) { exp.moveTo(e); closeGui(); } ++i; } GUILayout.EndScrollView(); if (GUILayout.Button("Close")) { closeGui(); } GUILayout.EndVertical(); String hover = GUI.tooltip; try { int hoverIndex = int.Parse(hover); targets[hoverIndex].part.SetHighlightColor(Color.cyan); targets[hoverIndex].part.SetHighlightType(Part.HighlightType.AlwaysOn); targets[hoverIndex].part.SetHighlight(true, false); } catch (FormatException) { resetHighlight(); } GUI.DragWindow(); }