private void createTrackList()
{
//Debug.Log("creating track list object");
//var noExpandWidth = GUILayout.ExpandWidth(false);
//But the basic way of showing a tooltip would be, in effect, to just do GUILayout.Box(new Rect(mouseX,mouseY, someWidth, someHeight),GUI.tooltip) to have a hovertip.
trackListScroll = GUILayout.BeginScrollView(trackListScroll, false, true);
for (int i = 0; i < TrackManager.Instance.allTracks.Count; ++i)
{
Track track = TrackManager.Instance.allTracks.ElementAt(i);
GUILayout.BeginHorizontal(/*noExpandWidth*/); // BEGIN path widgets
//Name //ShowToggle Delete Continue
//GUIStyle trackColorFontStyle = new GUIStyle();
//trackColorFontStyle.normal.textColor = track.LineColor;
GUILayout.Label(TrackManager.Instance.allTracks.ElementAt(i).TrackName, GUIResources.LabelStyle, GUILayout.ExpandWidth(true), GUILayout.Height(26));
//track length is only calculated when we are on the same planet to prevent floating point issues
string lengthString;
if (FlightGlobals.currentMainBody == TrackManager.Instance.allTracks.ElementAt(i).ReferenceBody)
{
lengthString = Utilities.distanceString(TrackManager.Instance.allTracks.ElementAt(i).length());
}
else
{
lengthString = "on " + TrackManager.Instance.allTracks.ElementAt(i).ReferenceBody.bodyName;
}
GUILayout.Label(lengthString, GUIResources.LabelStyle, GUILayout.Width(75), GUILayout.Height(26));
if (trackColorTextures.Count < i + 1)
{
//create new texture
Texture2D colorTex = new Texture2D(20, 20);
Utilities.SetTextureColor(colorTex, 20, 20, track.LineColor);
trackColorTextures.Add(colorTex);
}
GUILayout.Label(trackColorTextures[i], GUILayout.Width(26), GUILayout.Height(26));
Texture2D showIconTex;
if (track.Visible)
{
showIconTex = visibleTex;
}
else
{
showIconTex = invisibleTex;
}
if (GUILayout.Button(new GUIContent(showIconTex, "toggle visibility"), GUIResources.ButtonStyle, GUILayout.Width(26), GUILayout.Height(26)))
{
track.toggleVisibility();
}
if (GUILayout.Button(new GUIContent(deleteTex, "delete track"), GUIResources.ButtonStyle, GUILayout.Width(26), GUILayout.Height(26)))
{
TrackManager.Instance.deleteTrack(ref track);
trackColorTextures.RemoveAt(i);
if (i >= TrackManager.Instance.allTracks.Count)
{
break;
}
}
GUI.enabled = TrackManager.Instance.isRecordingAllowed();
if (GUILayout.Button(new GUIContent(continueTex, "resume track with current vessel"), GUIResources.ButtonStyle, GUILayout.Width(26), GUILayout.Height(26)))
{
TrackManager.Instance.continueTrack(track);
}
GUI.enabled = true;
if (GUILayout.Button(new GUIContent(editTex, "edit track properties"), GUIResources.ButtonStyle, GUILayout.Width(26), GUILayout.Height(26)))
{
if (ExplorerTrackBehaviour.Instance.currentlyOpenTrackEditWindow != null)
{
ExplorerTrackBehaviour.Instance.currentlyOpenTrackEditWindow.SetVisible(false);
}
ExplorerTrackBehaviour.Instance.currentlyOpenTrackEditWindow = new TrackEditWindow(track, this);
ExplorerTrackBehaviour.Instance.currentlyOpenTrackEditWindow.SetVisible(true);
}
if (GUILayout.Button(new GUIContent(playbackTex, "playback track"), GUIResources.ButtonStyle, GUILayout.Width(26), GUILayout.Height(26)))
{
ExplorerTrackBehaviour.Instance.replaywindow = new ReplayWindow(track);
ExplorerTrackBehaviour.Instance.replaywindow.Awake();
ExplorerTrackBehaviour.Instance.replaywindow.SetVisible(true);
}
GUILayout.EndHorizontal(); // END path widgets
}
GUILayout.EndScrollView();
}