You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-04 17:04:49 +00:00
Added documentation comments to the .NET library
Comments have been added for the following: modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/DisableGodotGeneratorsAttribute.cs modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportAttribute.cs modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotMethodAttribute.cs modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs
This commit is contained in:
committed by
Aaron Franke
parent
8df8fff54b
commit
003ad31ed5
@@ -2,17 +2,27 @@ using System;
|
|||||||
|
|
||||||
namespace Godot
|
namespace Godot
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An attribute that determines if an assembly has scripts. If so, what types of scripts the assembly has.
|
||||||
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Assembly)]
|
[AttributeUsage(AttributeTargets.Assembly)]
|
||||||
public class AssemblyHasScriptsAttribute : Attribute
|
public class AssemblyHasScriptsAttribute : Attribute
|
||||||
{
|
{
|
||||||
private readonly bool requiresLookup;
|
private readonly bool requiresLookup;
|
||||||
private readonly System.Type[] scriptTypes;
|
private readonly System.Type[] scriptTypes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new AssemblyHasScriptsAttribute instance.
|
||||||
|
/// </summary>
|
||||||
public AssemblyHasScriptsAttribute()
|
public AssemblyHasScriptsAttribute()
|
||||||
{
|
{
|
||||||
requiresLookup = true;
|
requiresLookup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new AssemblyHasScriptsAttribute instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="scriptTypes">The specified type(s) of scripts.</param>
|
||||||
public AssemblyHasScriptsAttribute(System.Type[] scriptTypes)
|
public AssemblyHasScriptsAttribute(System.Type[] scriptTypes)
|
||||||
{
|
{
|
||||||
requiresLookup = false;
|
requiresLookup = false;
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using System;
|
|||||||
|
|
||||||
namespace Godot
|
namespace Godot
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An attribute that disables Godot Generators.
|
||||||
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public class DisableGodotGeneratorsAttribute : Attribute { }
|
public class DisableGodotGeneratorsAttribute : Attribute { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,20 @@ using System;
|
|||||||
|
|
||||||
namespace Godot
|
namespace Godot
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An attribute used to export objects.
|
||||||
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
||||||
public class ExportAttribute : Attribute
|
public class ExportAttribute : Attribute
|
||||||
{
|
{
|
||||||
private PropertyHint hint;
|
private PropertyHint hint;
|
||||||
private string hintString;
|
private string hintString;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new ExportAttribute Instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hint">A hint to the exported object.</param>
|
||||||
|
/// <param name="hintString">A string representing the exported object.</param>
|
||||||
public ExportAttribute(PropertyHint hint = PropertyHint.None, string hintString = "")
|
public ExportAttribute(PropertyHint hint = PropertyHint.None, string hintString = "")
|
||||||
{
|
{
|
||||||
this.hint = hint;
|
this.hint = hint;
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using System;
|
|||||||
|
|
||||||
namespace Godot
|
namespace Godot
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An attribute for a method.
|
||||||
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
internal class GodotMethodAttribute : Attribute
|
internal class GodotMethodAttribute : Attribute
|
||||||
{
|
{
|
||||||
@@ -9,6 +12,10 @@ namespace Godot
|
|||||||
|
|
||||||
public string MethodName { get { return methodName; } }
|
public string MethodName { get { return methodName; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new GodotMethodAttribute instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="methodName">The name of the method.</param>
|
||||||
public GodotMethodAttribute(string methodName)
|
public GodotMethodAttribute(string methodName)
|
||||||
{
|
{
|
||||||
this.methodName = methodName;
|
this.methodName = methodName;
|
||||||
|
|||||||
@@ -2,9 +2,15 @@ using System;
|
|||||||
|
|
||||||
namespace Godot
|
namespace Godot
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new AnyPeerAttribute instance. Members with the AnyPeerAttribute are given authority over their own player.
|
||||||
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
public class AnyPeerAttribute : Attribute { }
|
public class AnyPeerAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new AuthorityAttribute instance. Members with the AuthorityAttribute are given authority over the game.
|
||||||
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
public class AuthorityAttribute : Attribute { }
|
public class AuthorityAttribute : Attribute { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,18 @@ using System;
|
|||||||
|
|
||||||
namespace Godot
|
namespace Godot
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An attribute that contains the path to the object's script.
|
||||||
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||||
public class ScriptPathAttribute : Attribute
|
public class ScriptPathAttribute : Attribute
|
||||||
{
|
{
|
||||||
private string path;
|
private string path;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new ScriptPathAttribute instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The file path to the script</param>
|
||||||
public ScriptPathAttribute(string path)
|
public ScriptPathAttribute(string path)
|
||||||
{
|
{
|
||||||
this.path = path;
|
this.path = path;
|
||||||
|
|||||||
@@ -4,9 +4,16 @@ namespace Godot
|
|||||||
{
|
{
|
||||||
public static class Dispatcher
|
public static class Dispatcher
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Implements an external instance of GodotTaskScheduler.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A GodotTaskScheduler instance.</returns>
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
private static extern GodotTaskScheduler godot_icall_DefaultGodotTaskScheduler();
|
private static extern GodotTaskScheduler godot_icall_DefaultGodotTaskScheduler();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the synchronization context as the context of the GodotTaskScheduler.
|
||||||
|
/// </summary>
|
||||||
public static GodotSynchronizationContext SynchronizationContext =>
|
public static GodotSynchronizationContext SynchronizationContext =>
|
||||||
godot_icall_DefaultGodotTaskScheduler().Context;
|
godot_icall_DefaultGodotTaskScheduler().Context;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ namespace Godot
|
|||||||
_queue.Add(new KeyValuePair<SendOrPostCallback, object>(d, state));
|
_queue.Add(new KeyValuePair<SendOrPostCallback, object>(d, state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calls the Key method on each workItem object in the _queue to activate their callbacks.
|
||||||
|
/// </summary>
|
||||||
public void ExecutePendingContinuations()
|
public void ExecutePendingContinuations()
|
||||||
{
|
{
|
||||||
while (_queue.TryTake(out var workItem))
|
while (_queue.TryTake(out var workItem))
|
||||||
|
|||||||
@@ -6,11 +6,25 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Godot
|
namespace Godot
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// GodotTaskScheduler contains a linked list of tasks to perform as a queue. Methods
|
||||||
|
/// within the class are used to control the queue and perform the contained tasks.
|
||||||
|
/// </summary>
|
||||||
public class GodotTaskScheduler : TaskScheduler
|
public class GodotTaskScheduler : TaskScheduler
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The current synchronization context.
|
||||||
|
/// </summary>
|
||||||
internal GodotSynchronizationContext Context { get; }
|
internal GodotSynchronizationContext Context { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The queue of tasks for the task scheduler.
|
||||||
|
/// </summary>
|
||||||
private readonly LinkedList<Task> _tasks = new LinkedList<Task>();
|
private readonly LinkedList<Task> _tasks = new LinkedList<Task>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new GodotTaskScheduler instance.
|
||||||
|
/// </summary>
|
||||||
public GodotTaskScheduler()
|
public GodotTaskScheduler()
|
||||||
{
|
{
|
||||||
Context = new GodotSynchronizationContext();
|
Context = new GodotSynchronizationContext();
|
||||||
@@ -53,12 +67,19 @@ namespace Godot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Executes all queued tasks and pending tasks from the current context.
|
||||||
|
/// </summary>
|
||||||
public void Activate()
|
public void Activate()
|
||||||
{
|
{
|
||||||
ExecuteQueuedTasks();
|
ExecuteQueuedTasks();
|
||||||
Context.ExecutePendingContinuations();
|
Context.ExecutePendingContinuations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loops through and attempts to execute each task in _tasks.
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="InvalidOperationException"></exception>
|
||||||
private void ExecuteQueuedTasks()
|
private void ExecuteQueuedTasks()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
namespace Godot
|
namespace Godot
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An interface that requires a GetAwaiter() method to get a reference to the Awaiter.
|
||||||
|
/// </summary>
|
||||||
public interface IAwaitable
|
public interface IAwaitable
|
||||||
{
|
{
|
||||||
IAwaiter GetAwaiter();
|
IAwaiter GetAwaiter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A templated interface that requires a GetAwaiter() method to get a reference to the Awaiter.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TResult">A reference to the result to be passed out.</typeparam>
|
||||||
public interface IAwaitable<out TResult>
|
public interface IAwaitable<out TResult>
|
||||||
{
|
{
|
||||||
IAwaiter<TResult> GetAwaiter();
|
IAwaiter<TResult> GetAwaiter();
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace Godot
|
namespace Godot
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An interface that requires a boolean for completion status and a method that gets the result of completion.
|
||||||
|
/// </summary>
|
||||||
public interface IAwaiter : INotifyCompletion
|
public interface IAwaiter : INotifyCompletion
|
||||||
{
|
{
|
||||||
bool IsCompleted { get; }
|
bool IsCompleted { get; }
|
||||||
@@ -9,6 +12,10 @@ namespace Godot
|
|||||||
void GetResult();
|
void GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A templated interface that requires a boolean for completion status and a method that gets the result of completion and returns it.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TResult">A reference to the result to be passed out.</typeparam>
|
||||||
public interface IAwaiter<out TResult> : INotifyCompletion
|
public interface IAwaiter<out TResult> : INotifyCompletion
|
||||||
{
|
{
|
||||||
bool IsCompleted { get; }
|
bool IsCompleted { get; }
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
namespace Godot
|
namespace Godot
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An interface that requires methods for before and after serialization.
|
||||||
|
/// </summary>
|
||||||
public interface ISerializationListener
|
public interface ISerializationListener
|
||||||
{
|
{
|
||||||
void OnBeforeSerialize();
|
void OnBeforeSerialize();
|
||||||
|
|||||||
Reference in New Issue
Block a user