forked from Unity-Technologies/EditorXR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert ISetTooltipVisibility to IProvides/UsesSetTooltipVisibility
- Loading branch information
Showing
29 changed files
with
183 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...nterfaces/Capability/ITooltipPlacement.cs → Interfaces/Capability/ITooltipPlacement.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ime/Scripts/Interfaces/Entity/ITooltip.cs → Interfaces/Entity/ITooltip.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using Unity.Labs.ModuleLoader; | ||
|
||
namespace Unity.Labs.EditorXR.Interfaces | ||
{ | ||
/// <summary> | ||
/// Provide access to tooltip visibility | ||
/// </summary> | ||
public interface IProvidesSetTooltipVisibility : IFunctionalityProvider | ||
{ | ||
/// <summary> | ||
/// Show a Tooltip. Calling ShowTooltip on an ITooltip that was just shown will update its placement and timing | ||
/// </summary> | ||
/// <param name="tooltip">The tooltip to show</param> | ||
/// <param name="persistent">Whether the tooltip should stay visible regardless of raycasts</param> | ||
/// <param name="duration">If the tooltip is shown persistently, and duration is less than 0, hide after the | ||
/// duration, in seconds. If duration greater than 0, placement is updated but timing is not affected. If | ||
/// duration is exactly 0, tooltip stays visible until explicitly hidden</param> | ||
/// <param name="placement">(Optional) The ITooltipPlacement object used to place the tooltip. If no placement | ||
/// is specified, we assume the ITooltip is a component and use its own Transform</param> | ||
/// <param name="becameVisible">(Optional) Called as soon as the tooltip becomes visible</param> | ||
void ShowTooltip(ITooltip tooltip, bool persistent = false, float duration = 0f, | ||
ITooltipPlacement placement = null, Action becameVisible = null); | ||
|
||
/// <summary> | ||
/// Hide the given Tooltip | ||
/// </summary> | ||
/// <param name="tooltip">The tooltip to hide</param> | ||
/// <param name="persistent">Whether to hide the tooltip if it was shown with the persistent argument set to true</param> | ||
void HideTooltip(ITooltip tooltip, bool persistent = false); | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...tyInjection/ISetTooltipVisibility.cs.meta → ...ers/IProvidesSetTooltipVisibility.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
95 changes: 48 additions & 47 deletions
95
...onalityInjection/ISetTooltipVisibility.cs → .../Subscribers/IUsesSetTooltipVisibility.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,48 @@ | ||
using System; | ||
|
||
namespace UnityEditor.Experimental.EditorVR | ||
{ | ||
/// <summary> | ||
/// Provides access to the ability to show or hide a Tooltip | ||
/// </summary> | ||
public interface ISetTooltipVisibility | ||
{ | ||
} | ||
|
||
public static class ISetTooltipVisibilityMethods | ||
{ | ||
internal delegate void ShowTooltipDelegate(ITooltip tooltip, bool persistent = false, float duration = 0f, | ||
ITooltipPlacement placement = null, Action becameVisible = null); | ||
|
||
internal static ShowTooltipDelegate showTooltip { get; set; } | ||
internal static Action<ITooltip, bool> hideTooltip { get; set; } | ||
|
||
/// <summary> | ||
/// Show a Tooltip. Calling ShowTooltip on an ITooltip that was just shown will update its placement and timing | ||
/// </summary> | ||
/// <param name="tooltip">The tooltip to show</param> | ||
/// <param name="persistent">Whether the tooltip should stay visible regardless of raycasts</param> | ||
/// <param name="duration">If the tooltip is shown persistently, and duration is less than 0, hide after the | ||
/// duration, in seconds. If duration greater than 0, placement is updated but timing is not affected. If | ||
/// duration is exactly 0, tooltip stays visible until explicitly hidden</param> | ||
/// <param name="placement">(Optional) The ITooltipPlacement object used to place the tooltip. If no placement | ||
/// is specified, we assume the ITooltip is a component and use its own Transform</param> | ||
/// <param name="becameVisible">(Optional) Called as soon as the tooltip becomes visible</param> | ||
public static void ShowTooltip(this ISetTooltipVisibility obj, ITooltip tooltip, bool persistent = false, | ||
float duration = 0f, ITooltipPlacement placement = null, Action becameVisible = null) | ||
{ | ||
showTooltip(tooltip, persistent, duration, placement, becameVisible); | ||
} | ||
|
||
/// <summary> | ||
/// Hide the given Tooltip | ||
/// </summary> | ||
/// <param name="tooltip">The tooltip to hide</param> | ||
/// <param name="persistent">Whether to hide the tooltip if it was shown with the persistent argument set to true</param> | ||
public static void HideTooltip(this ISetTooltipVisibility obj, ITooltip tooltip, bool persistent = false) | ||
{ | ||
hideTooltip(tooltip, persistent); | ||
} | ||
} | ||
} | ||
using System; | ||
using Unity.Labs.ModuleLoader; | ||
|
||
namespace Unity.Labs.EditorXR.Interfaces | ||
{ | ||
/// <summary> | ||
/// Gives decorated class control of tooltip visibility | ||
/// </summary> | ||
public interface IUsesSetTooltipVisibility : IFunctionalitySubscriber<IProvidesSetTooltipVisibility> | ||
{ | ||
} | ||
|
||
public static class UsesSetTooltipVisibilityMethods | ||
{ | ||
/// <summary> | ||
/// Show a Tooltip. Calling ShowTooltip on an ITooltip that was just shown will update its placement and timing | ||
/// </summary> | ||
/// <param name="user">The functionality user</param> | ||
/// <param name="tooltip">The tooltip to show</param> | ||
/// <param name="persistent">Whether the tooltip should stay visible regardless of raycasts</param> | ||
/// <param name="duration">If the tooltip is shown persistently, and duration is less than 0, hide after the | ||
/// duration, in seconds. If duration greater than 0, placement is updated but timing is not affected. If | ||
/// duration is exactly 0, tooltip stays visible until explicitly hidden</param> | ||
/// <param name="placement">(Optional) The ITooltipPlacement object used to place the tooltip. If no placement | ||
/// is specified, we assume the ITooltip is a component and use its own Transform</param> | ||
/// <param name="becameVisible">(Optional) Called as soon as the tooltip becomes visible</param> | ||
public static void ShowTooltip(this IUsesSetTooltipVisibility user, ITooltip tooltip, bool persistent = false, | ||
float duration = 0f, ITooltipPlacement placement = null, Action becameVisible = null) | ||
{ | ||
#if !FI_AUTOFILL | ||
user.provider.ShowTooltip(tooltip, persistent, duration, placement, becameVisible); | ||
#endif | ||
} | ||
|
||
/// <summary> | ||
/// Hide the given Tooltip | ||
/// </summary> | ||
/// <param name="user">The functionality user</param> | ||
/// <param name="tooltip">The tooltip to hide</param> | ||
/// <param name="persistent">Whether to hide the tooltip if it was shown with the persistent argument set to true</param> | ||
public static void HideTooltip(this IUsesSetTooltipVisibility user, ITooltip tooltip, bool persistent = false) | ||
{ | ||
#if !FI_AUTOFILL | ||
user.provider.ShowTooltip(tooltip, persistent); | ||
#endif | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using System; | ||
using Unity.Labs.EditorXR.Interfaces; | ||
|
||
namespace UnityEditor.Experimental.EditorVR | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.