Update HotReload
This commit is contained in:
@@ -12,55 +12,56 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
[Overlay(typeof(SceneView), Translations.MenuItems.OverlayDescription, true)]
|
||||
[Icon("Assets/HotReload/Editor/Resources/Icon_DarkMode.png")]
|
||||
internal class HotReloadOverlay : ToolbarOverlay {
|
||||
HotReloadOverlay() : base(HotReloadToolbarIndicationButton.id, HotReloadToolbarEventsButton.id, HotReloadToolbarRecompileButton.id) {
|
||||
HotReloadOverlay() : base(HotReloadToolbarLogoButton.id, HotReloadToolbarIndicationButton.id, HotReloadToolbarRecompileButton.id) {
|
||||
EditorApplication.update += Update;
|
||||
}
|
||||
|
||||
[EditorToolbarElement(id, typeof(SceneView))]
|
||||
class HotReloadToolbarLogoButton : EditorToolbarButton, IAccessContainerWindow {
|
||||
internal const string id = "HotReloadOverlay/LogoButton";
|
||||
public EditorWindow containerWindow { get; set; }
|
||||
|
||||
bool lastShowingRedDot;
|
||||
|
||||
internal HotReloadToolbarLogoButton() {
|
||||
icon = HotReloadState.ShowingRedDot ? GUIHelper.GetInvertibleIcon(InvertibleIcon.LogoNew) : GUIHelper.GetInvertibleIcon(InvertibleIcon.Logo);
|
||||
tooltip = "Hot Reload";
|
||||
clicked += OnClick;
|
||||
EditorApplication.update += Update;
|
||||
}
|
||||
|
||||
void OnClick() {
|
||||
HotReloadWindow.Open();
|
||||
if (HotReloadWindow.Current) {
|
||||
HotReloadWindow.Current.SelectTab(typeof(HotReloadRunTab));
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (lastShowingRedDot != HotReloadState.ShowingRedDot) {
|
||||
icon = HotReloadState.ShowingRedDot ? GUIHelper.GetInvertibleIcon(InvertibleIcon.LogoNew) : GUIHelper.GetInvertibleIcon(InvertibleIcon.Logo);
|
||||
lastShowingRedDot = HotReloadState.ShowingRedDot;
|
||||
}
|
||||
}
|
||||
|
||||
~HotReloadToolbarLogoButton() {
|
||||
clicked -= OnClick;
|
||||
EditorApplication.update -= Update;
|
||||
}
|
||||
}
|
||||
|
||||
EditorIndicationState.IndicationStatus lastIndicationStatus;
|
||||
|
||||
[EditorToolbarElement(id, typeof(SceneView))]
|
||||
class HotReloadToolbarIndicationButton : EditorToolbarButton, IAccessContainerWindow {
|
||||
internal const string id = "HotReloadOverlay/LogoButton";
|
||||
internal const string id = "HotReloadOverlay/IndicationButton";
|
||||
public EditorWindow containerWindow { get; set; }
|
||||
|
||||
EditorIndicationState.IndicationStatus lastIndicationStatus;
|
||||
|
||||
internal HotReloadToolbarIndicationButton() {
|
||||
icon = GetIndicationIcon();
|
||||
tooltip = EditorIndicationState.IndicationStatusText;
|
||||
clicked += OnClick;
|
||||
EditorApplication.update += Update;
|
||||
}
|
||||
|
||||
void OnClick() {
|
||||
EditorWindow.GetWindow<HotReloadWindow>().Show();
|
||||
EditorWindow.GetWindow<HotReloadWindow>().SelectTab(typeof(HotReloadRunTab));
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (lastIndicationStatus != EditorIndicationState.CurrentIndicationStatus) {
|
||||
icon = GetIndicationIcon();
|
||||
tooltip = EditorIndicationState.IndicationStatusText;
|
||||
lastIndicationStatus = EditorIndicationState.CurrentIndicationStatus;
|
||||
}
|
||||
}
|
||||
|
||||
~HotReloadToolbarIndicationButton() {
|
||||
clicked -= OnClick;
|
||||
EditorApplication.update -= Update;
|
||||
}
|
||||
}
|
||||
|
||||
[EditorToolbarElement(id, typeof(SceneView))]
|
||||
class HotReloadToolbarEventsButton : EditorToolbarButton, IAccessContainerWindow {
|
||||
internal const string id = "HotReloadOverlay/EventsButton";
|
||||
public EditorWindow containerWindow { get; set; }
|
||||
|
||||
bool lastShowingRedDot;
|
||||
|
||||
internal HotReloadToolbarEventsButton() {
|
||||
icon = HotReloadState.ShowingRedDot ? GUIHelper.GetInvertibleIcon(InvertibleIcon.EventsNew) : GUIHelper.GetInvertibleIcon(InvertibleIcon.Events);
|
||||
tooltip = Translations.Timeline.EventsTooltip;
|
||||
tooltip = string.Format(Translations.Timeline.IndicationTooltip, EditorIndicationState.IndicationStatusText);
|
||||
clicked += OnClick;
|
||||
EditorApplication.update += Update;
|
||||
}
|
||||
@@ -70,13 +71,14 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (lastShowingRedDot != HotReloadState.ShowingRedDot) {
|
||||
icon = HotReloadState.ShowingRedDot ? GUIHelper.GetInvertibleIcon(InvertibleIcon.EventsNew) : GUIHelper.GetInvertibleIcon(InvertibleIcon.Events);
|
||||
lastShowingRedDot = HotReloadState.ShowingRedDot;
|
||||
if (lastIndicationStatus != EditorIndicationState.CurrentIndicationStatus) {
|
||||
icon = GetIndicationIcon();
|
||||
tooltip = string.Format(Translations.Timeline.IndicationTooltip, EditorIndicationState.IndicationStatusText);
|
||||
lastIndicationStatus = EditorIndicationState.CurrentIndicationStatus;
|
||||
}
|
||||
}
|
||||
|
||||
~HotReloadToolbarEventsButton() {
|
||||
~HotReloadToolbarIndicationButton() {
|
||||
clicked -= OnClick;
|
||||
EditorApplication.update -= Update;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user