0.6.3: Fixed issue, where toolbar items didn't accept mouse input in 2021 or newer versions
This commit is contained in:
parent
17c55cd03c
commit
99c83ea6d3
9 changed files with 186 additions and 73 deletions
|
|
@ -1,6 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Game.NavigationTool.Editor.Toolbar;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
|
@ -10,18 +9,17 @@ using UnityEngine.SceneManagement;
|
|||
namespace Game.NavigationTool.Editor.Tools
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolScenePicker : IToolbarDrawer
|
||||
internal sealed class ToolScenePicker : AbstractToolbarDrawer
|
||||
{
|
||||
public bool Visible => true;
|
||||
public bool Enabled => !EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode;
|
||||
public EToolbarPlacement Placement => EToolbarPlacement.Right;
|
||||
public override bool Enabled => !EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode;
|
||||
public override EToolbarPlacement Placement => EToolbarPlacement.Right;
|
||||
|
||||
private static bool IS_DIRTY = true;
|
||||
private static int SELECTED_INDEX = -1;
|
||||
private static string[] OPTIONS = new string[0];
|
||||
private static string[] PATHS = new string[0];
|
||||
|
||||
private void Initialize()
|
||||
|
||||
private static void Initialize()
|
||||
{
|
||||
if (!IS_DIRTY)
|
||||
return;
|
||||
|
|
@ -67,13 +65,13 @@ namespace Game.NavigationTool.Editor.Tools
|
|||
SELECTED_INDEX = listPaths.IndexOf(activeScene.path);
|
||||
IS_DIRTY = false;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void Draw(Rect rect, Styles styles)
|
||||
protected override void Draw(Rect rect)
|
||||
{
|
||||
Initialize();
|
||||
int temp = EditorGUI.Popup(rect, SELECTED_INDEX, OPTIONS, styles.popup);
|
||||
|
|
@ -90,7 +88,7 @@ namespace Game.NavigationTool.Editor.Tools
|
|||
}
|
||||
}
|
||||
|
||||
public float CalculateWidth()
|
||||
public override float CalculateWidth()
|
||||
{
|
||||
return 100.0f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using Game.NavigationTool.Editor.Toolbar;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
|
|
@ -9,17 +8,16 @@ using UTools = UnityEditor.Tools;
|
|||
namespace Game.NavigationTool.Editor.Tools
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolUICanvasPicker : IToolbarDrawer
|
||||
internal sealed class ToolUICanvasPicker : AbstractToolbarDrawer
|
||||
{
|
||||
public bool Visible => true;
|
||||
public bool Enabled => (UTools.visibleLayers & (1 << LayerMask.NameToLayer("UI"))) != 0;
|
||||
public EToolbarPlacement Placement => EToolbarPlacement.Left;
|
||||
public override bool Enabled => (UTools.visibleLayers & (1 << LayerMask.NameToLayer("UI"))) != 0;
|
||||
public override EToolbarPlacement Placement => EToolbarPlacement.Left;
|
||||
|
||||
private static bool IS_DIRTY = true;
|
||||
private static string[] OPTIONS = new string[0];
|
||||
private static int[] INSTANCE_IDS = new int[0];
|
||||
|
||||
private void Initialize()
|
||||
|
||||
private static void Initialize()
|
||||
{
|
||||
if (!IS_DIRTY)
|
||||
return;
|
||||
|
|
@ -48,13 +46,13 @@ namespace Game.NavigationTool.Editor.Tools
|
|||
INSTANCE_IDS = listIds.ToArray();
|
||||
IS_DIRTY = false;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void Draw(Rect rect, Styles styles)
|
||||
protected override void Draw(Rect rect)
|
||||
{
|
||||
Initialize();
|
||||
int temp = EditorGUI.Popup(rect, 0, OPTIONS, styles.popup);
|
||||
|
|
@ -62,8 +60,8 @@ namespace Game.NavigationTool.Editor.Tools
|
|||
if (temp != 0 && OPTIONS.Length != 1)
|
||||
Focus(INSTANCE_IDS[temp]);
|
||||
}
|
||||
|
||||
public float CalculateWidth()
|
||||
|
||||
public override float CalculateWidth()
|
||||
{
|
||||
return 100.0f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Game.NavigationTool.Editor.Toolbar;
|
||||
using JetBrains.Annotations;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UTools = UnityEditor.Tools;
|
||||
|
|
@ -7,17 +6,12 @@ using UTools = UnityEditor.Tools;
|
|||
namespace Game.NavigationTool.Editor.Tools
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class ToolUILayerToggle : IToolbarDrawer
|
||||
internal sealed class ToolUILayerToggle : AbstractToolbarDrawer
|
||||
{
|
||||
public bool Visible => true;
|
||||
public bool Enabled => true;
|
||||
public EToolbarPlacement Placement => EToolbarPlacement.Left;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
}
|
||||
public override bool Enabled => true;
|
||||
public override EToolbarPlacement Placement => EToolbarPlacement.Left;
|
||||
|
||||
public void Draw(Rect rect, Styles styles)
|
||||
protected override void Draw(Rect rect)
|
||||
{
|
||||
int layer = 1 << LayerMask.NameToLayer("UI");
|
||||
bool value = (UTools.visibleLayers & layer) != 0;
|
||||
|
|
@ -39,7 +33,7 @@ namespace Game.NavigationTool.Editor.Tools
|
|||
}
|
||||
}
|
||||
|
||||
public float CalculateWidth()
|
||||
public override float CalculateWidth()
|
||||
{
|
||||
return 30.0f;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue