From bee577d945dacacd17339ffaf52f1525586ec557 Mon Sep 17 00:00:00 2001 From: desktop-maesty/steve Date: Tue, 7 Aug 2018 20:59:58 +1000 Subject: [PATCH] BasePopupWindowContent now has None as optional --- Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs | 7 +++++-- .../Editor/PopupContent/EventSelectorPopupWindowContent.cs | 2 +- .../PopupContent/VariableSelectPopupWindowContent.cs | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs b/Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs index 3c7339de..5bf7406e 100644 --- a/Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs +++ b/Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs @@ -53,13 +53,15 @@ namespace Fungus.EditorUtils protected float scrollOffset; protected int currentIndex; protected Vector2 size; + protected bool hasNoneOption = false; static readonly char[] SEARCH_SPLITS = new char[]{ CATEGORY_CHAR, ' ' }; protected static readonly char CATEGORY_CHAR = '/'; - public BasePopupWindowContent(string currentHandlerName, int width, int height) + public BasePopupWindowContent(string currentHandlerName, int width, int height, bool showNoneOption = false) { this.size = new Vector2(width, height); + hasNoneOption = showNoneOption; PrepareAllItems(); @@ -140,7 +142,8 @@ namespace Fungus.EditorUtils hoverIndex = 0; scroll = Vector2.zero; - visibleItems.Insert(0, new FilteredListItem(-1, "None")); + if(hasNoneOption) + visibleItems.Insert(0, new FilteredListItem(-1, "None")); } private void DrawSelectionArea(Rect scrollRect) diff --git a/Assets/Fungus/Scripts/Editor/PopupContent/EventSelectorPopupWindowContent.cs b/Assets/Fungus/Scripts/Editor/PopupContent/EventSelectorPopupWindowContent.cs index af9562ab..d5c28624 100644 --- a/Assets/Fungus/Scripts/Editor/PopupContent/EventSelectorPopupWindowContent.cs +++ b/Assets/Fungus/Scripts/Editor/PopupContent/EventSelectorPopupWindowContent.cs @@ -32,7 +32,7 @@ namespace Fungus.EditorUtils protected Block block; public EventSelectorPopupWindowContent(string currentHandlerName, Block block, int width, int height) - :base(currentHandlerName, width, height) + :base(currentHandlerName, width, height, true) { this.block = block; } diff --git a/Assets/Fungus/Scripts/Editor/PopupContent/VariableSelectPopupWindowContent.cs b/Assets/Fungus/Scripts/Editor/PopupContent/VariableSelectPopupWindowContent.cs index 38630489..4a72e1d2 100644 --- a/Assets/Fungus/Scripts/Editor/PopupContent/VariableSelectPopupWindowContent.cs +++ b/Assets/Fungus/Scripts/Editor/PopupContent/VariableSelectPopupWindowContent.cs @@ -6,6 +6,9 @@ using System.Linq; namespace Fungus.EditorUtils { + /// + /// Show the variable selection window as a searchable popup + /// public class VariableSelectPopupWindowContent : BasePopupWindowContent { static readonly int POPUP_WIDTH = 200, POPUP_HEIGHT = 200;