50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
using UnityEngine;
|
|
#if UNITY_6000_3_OR_NEWER
|
|
using System;
|
|
#endif
|
|
|
|
namespace Module.NavigationTool.Editor.Toolbar
|
|
{
|
|
#if UNITY_6000_3_OR_NEWER
|
|
[Obsolete("Unity has added a new API for adding elements to the main toolbar. Check: <url=https://docs.unity3d.com/6000.3/Documentation/ScriptReference/Toolbars.MainToolbarElement.html>MainToolbarElement</url>.")]
|
|
#endif
|
|
public abstract class AbstractToolbarDrawer
|
|
{
|
|
public abstract bool Visible { get; }
|
|
public abstract bool Enabled { get; }
|
|
public abstract EToolbarPlacement Placement { get; }
|
|
public abstract int Priority { get; }
|
|
|
|
protected Styles styles;
|
|
|
|
#if !UNITY_6000_3_OR_NEWER
|
|
private Rect rect;
|
|
|
|
public void Setup(Rect rect)
|
|
{
|
|
this.rect = rect;
|
|
}
|
|
#endif
|
|
|
|
public virtual void Update()
|
|
{
|
|
}
|
|
|
|
#if !UNITY_6000_3_OR_NEWER
|
|
public void OnGUI()
|
|
{
|
|
if (styles == null)
|
|
styles = new Styles();
|
|
|
|
styles.Initialize(GUI.skin);
|
|
|
|
GUI.enabled = Enabled;
|
|
Draw(rect);
|
|
GUI.enabled = true;
|
|
}
|
|
#endif
|
|
|
|
protected abstract void Draw(Rect rect);
|
|
public abstract float CalculateWidth();
|
|
}
|
|
} |