-
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.
- Loading branch information
Showing
44 changed files
with
553 additions
and
365 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
14 changes: 14 additions & 0 deletions
14
Packages/com.naukri.inspector-maid/Editor/Extensions/IBindingDataProviderExtensions.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Naukri.InspectorMaid.Core; | ||
|
||
namespace Naukri.InspectorMaid.Editor.Extensions | ||
{ | ||
public static class IBindingDataProviderExtensions | ||
{ | ||
// we have to use extension method, instead of default interface property. | ||
// so that we can use this method on the implementation of this interface without casting. | ||
public static bool IsBinding(this IBindingDataProvider self) | ||
{ | ||
return self.binding != null; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Packages/com.naukri.inspector-maid/Editor/Extensions/IBindingDataProviderExtensions.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
Packages/com.naukri.inspector-maid/Editor/LogicWidgetOf.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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Naukri.InspectorMaid.Core; | ||
using Naukri.InspectorMaid.Editor.Widgets.Core; | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Naukri.InspectorMaid.Editor | ||
{ | ||
public abstract class LogicWidgetOf<TAttribute> : LogicWidget, IWidgetProvider | ||
where TAttribute : LogicAttribute | ||
{ | ||
private TAttribute _attribute; | ||
|
||
[SuppressMessage("Style", "IDE1006")] | ||
public TAttribute attribute => _attribute; | ||
|
||
object IAttributeProvider.Attribute => _attribute; | ||
|
||
Type IWidgetProvider.RegisterType => typeof(TAttribute); | ||
|
||
IWidget IWidgetProvider.CloneWith(WidgetAttribute attribute) | ||
{ | ||
var cloned = (LogicWidgetOf<TAttribute>)MemberwiseClone(); | ||
|
||
cloned._attribute = attribute switch | ||
{ | ||
TAttribute tAttribute => tAttribute, | ||
_ => throw new Exception($"attribute type mismatch."), | ||
}; | ||
|
||
return cloned; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Packages/com.naukri.inspector-maid/Editor/LogicWidgetOf.cs.meta
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
Oops, something went wrong.