private void DrawPinnedFixtures() { GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.BeginHorizontal(); Heading("Pinned"); GUILayout.FlexibleSpace(); if (GUILayout.Button("Clear")) { PinnedSketchTracker.ClearPinned(); } GUILayout.EndHorizontal(); HorizontalLine(); foreach (var sketchAssembly in _sketches) { foreach (var sketchFixure in sketchAssembly.Fixtures) { if (PinnedSketchTracker.IsPinned(sketchFixure.FullName)) { DrawSketchRunnerGUIItem(sketchFixure); } } } GUILayout.EndVertical(); }
private void DrawSketchRunnerGUIItem(SketchFixture sketchFixture) { GUILayout.BeginHorizontal(); var nameGUISkin = EditorStyles.boldLabel; var nameGUICon = new GUIContent(sketchFixture.FullName); var descGUISkin = EditorStyles.miniLabel; var descGUICon = new GUIContent(sketchFixture.Description); var nameTextHeight = nameGUISkin.CalcHeight(nameGUICon, Screen.width - BUTTON_WIDTH); var descriptionTextHeight = descGUISkin.CalcHeight(descGUICon, Screen.width - BUTTON_WIDTH); var textHeight = nameTextHeight + descriptionTextHeight; var buttonHeight = GUILayout.Height(textHeight); var runButtonWidth = GUILayout.Width(textHeight * 1.4f); var playIconContent = new GUIContent(_playIcon); var runSketch = GUILayout.Button(playIconContent, buttonHeight, runButtonWidth); if (runSketch) { _selectedSketch = sketchFixture.TypeInfo; } var openButtonWidth = GUILayout.Width(textHeight); var editIconContent = new GUIContent(_editIcon); var openCode = GUILayout.Button(editIconContent, buttonHeight, openButtonWidth); if (openCode) { SketchAssetOpener.OpenSketch(sketchFixture.TypeInfo); } GUILayout.BeginVertical(); GUILayout.Label(nameGUICon, nameGUISkin); GUILayout.Label(descGUICon, descGUISkin); GUILayout.EndVertical(); var pinButtonSkin = new GUIStyle(GUI.skin.label); if (PinnedSketchTracker.IsPinned(sketchFixture.FullName)) { var unpinnedIconContent = new GUIContent(_pinnedIcon); var unpinClicked = GUILayout.Button(unpinnedIconContent, pinButtonSkin, buttonHeight, openButtonWidth); if (unpinClicked) { PinnedSketchTracker.UnpinSketch(sketchFixture.FullName); } } else { var pinnedIconContent = new GUIContent(_unpinnedIcon); var pinClicked = GUILayout.Button(pinnedIconContent, pinButtonSkin, buttonHeight, openButtonWidth); if (pinClicked) { PinnedSketchTracker.PinSketch(sketchFixture.FullName); } } GUILayout.EndHorizontal(); }