protected override void OnEnable() { titleContent = new GUIContent("Coil Manager", Icons.Coil(IconSize.Small)); RowHeight = 22; base.OnEnable(); }
private void RenderCoilId(Dictionary <string, LampState> lampStatuses, LampListData lampListData, Rect cellRect) { cellRect.x += 5; EditorGUI.LabelField(cellRect, lampListData.Id); // add some padding cellRect.x = cellRect.width - 45; cellRect.width -= 4; var iconRect = cellRect; iconRect.width = 20; if (Mouse.current.leftButton.wasPressedThisFrame && !MouseDownOnIcon && iconRect.Contains(Event.current.mousePosition)) { OnIconClick(lampListData, true); MouseDownOnIcon = true; } if (Mouse.current.leftButton.wasReleasedThisFrame && MouseDownOnIcon && iconRect.Contains(Event.current.mousePosition)) { OnIconClick(lampListData, false); MouseDownOnIcon = false; } var statusAvail = Application.isPlaying && lampStatuses != null && lampStatuses.ContainsKey(lampListData.Id); var icon = Icons.Coil(IconSize.Small, statusAvail && lampStatuses[lampListData.Id].IsOn ? IconColor.Orange : IconColor.Gray); if (icon != null) { var guiColor = GUI.color; GUI.color = Color.clear; EditorGUI.DrawTextureTransparent(iconRect, icon, ScaleMode.ScaleToFit); GUI.color = guiColor; } }