Browse Source

BasePopupWindowContent now has None as optional

master
desktop-maesty/steve 7 years ago
parent
commit
bee577d945
  1. 5
      Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs
  2. 2
      Assets/Fungus/Scripts/Editor/PopupContent/EventSelectorPopupWindowContent.cs
  3. 3
      Assets/Fungus/Scripts/Editor/PopupContent/VariableSelectPopupWindowContent.cs

5
Assets/Fungus/Scripts/Editor/BasePopupWindowContent.cs

@ -53,13 +53,15 @@ namespace Fungus.EditorUtils
protected float scrollOffset; protected float scrollOffset;
protected int currentIndex; protected int currentIndex;
protected Vector2 size; protected Vector2 size;
protected bool hasNoneOption = false;
static readonly char[] SEARCH_SPLITS = new char[]{ CATEGORY_CHAR, ' ' }; static readonly char[] SEARCH_SPLITS = new char[]{ CATEGORY_CHAR, ' ' };
protected static readonly 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); this.size = new Vector2(width, height);
hasNoneOption = showNoneOption;
PrepareAllItems(); PrepareAllItems();
@ -140,6 +142,7 @@ namespace Fungus.EditorUtils
hoverIndex = 0; hoverIndex = 0;
scroll = Vector2.zero; scroll = Vector2.zero;
if(hasNoneOption)
visibleItems.Insert(0, new FilteredListItem(-1, "None")); visibleItems.Insert(0, new FilteredListItem(-1, "None"));
} }

2
Assets/Fungus/Scripts/Editor/PopupContent/EventSelectorPopupWindowContent.cs

@ -32,7 +32,7 @@ namespace Fungus.EditorUtils
protected Block block; protected Block block;
public EventSelectorPopupWindowContent(string currentHandlerName, Block block, int width, int height) public EventSelectorPopupWindowContent(string currentHandlerName, Block block, int width, int height)
:base(currentHandlerName, width, height) :base(currentHandlerName, width, height, true)
{ {
this.block = block; this.block = block;
} }

3
Assets/Fungus/Scripts/Editor/PopupContent/VariableSelectPopupWindowContent.cs

@ -6,6 +6,9 @@ using System.Linq;
namespace Fungus.EditorUtils namespace Fungus.EditorUtils
{ {
/// <summary>
/// Show the variable selection window as a searchable popup
/// </summary>
public class VariableSelectPopupWindowContent : BasePopupWindowContent public class VariableSelectPopupWindowContent : BasePopupWindowContent
{ {
static readonly int POPUP_WIDTH = 200, POPUP_HEIGHT = 200; static readonly int POPUP_WIDTH = 200, POPUP_HEIGHT = 200;

Loading…
Cancel
Save