-
Notifications
You must be signed in to change notification settings - Fork 2
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
12 changed files
with
433 additions
and
211 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
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,53 +1,55 @@ | ||
#region | ||
|
||
using System; | ||
#if UNITY_EDITOR | ||
using System.Runtime.CompilerServices; | ||
#endif | ||
|
||
#endregion | ||
|
||
namespace AIO.UEditor | ||
{ | ||
/// <summary> | ||
/// 初始化属性 | ||
/// </summary> | ||
/// <c>使用方式</c> | ||
/// <code> | ||
/// [AInit(EInitAttrMode.Editor)] : 编辑器启动 | ||
/// [AInit(EInitAttrMode.RuntimeAfterAssembliesLoaded)] : 程序集加载 | ||
/// [AInit(0)] : 优先级 | ||
/// </code> | ||
[AttributeUsage(AttributeTargets.Method, Inherited = false)] | ||
public class AInitAttribute : Attribute | ||
{ | ||
public AInitAttribute(int order = 0 | ||
#if UNITY_EDITOR | ||
, | ||
[CallerFilePath] string filePath = "", | ||
[CallerLineNumber] int lineNumber = 0 | ||
#endif | ||
) | ||
public string FilePath { get; } | ||
public int LineNumber { get; } | ||
|
||
public AInitAttribute(int order = 0, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) | ||
{ | ||
#if UNITY_EDITOR | ||
FilePath = filePath.Replace("\\", "/"); | ||
LineNumber = lineNumber; | ||
#endif | ||
Order = order; | ||
Order = order; | ||
} | ||
|
||
public AInitAttribute(EInitAttrMode mode, | ||
int order = 0 | ||
#if UNITY_EDITOR | ||
, | ||
[CallerFilePath] string filePath = "", | ||
[CallerLineNumber] int lineNumber = 0 | ||
#endif | ||
) | ||
public AInitAttribute(EInitAttrMode mode, int order = 0, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) | ||
{ | ||
#if UNITY_EDITOR | ||
FilePath = filePath.Replace("\\", "/"); | ||
LineNumber = lineNumber + 1; | ||
#endif | ||
Mode = mode; | ||
Mode = mode; | ||
Order = order; | ||
} | ||
#else | ||
public AInitAttribute(int order = 0) { Order = order; } | ||
public AInitAttribute(EInitAttrMode mode, int order = 0) | ||
{ | ||
Mode = mode; | ||
Order = order; | ||
} | ||
#endif | ||
|
||
public EInitAttrMode Mode { get; set; } = EInitAttrMode.Editor; | ||
|
||
public int Order { get; set; } | ||
#if UNITY_EDITOR | ||
public string FilePath { get; } | ||
public int LineNumber { get; } | ||
#endif | ||
} | ||
} |
Oops, something went wrong.