コード例 #1
0
ファイル: Dictionary.cs プロジェクト: YeldhamDev/godot
 private Dictionary(godot_dictionary nativeValueToOwn)
 {
     NativeValue = (godot_dictionary.movable)(nativeValueToOwn.IsAllocated ?
                                              nativeValueToOwn :
                                              NativeFuncs.godotsharp_dictionary_new());
     _weakReferenceToSelf = DisposablesTracker.RegisterDisposable(this);
 }
コード例 #2
0
ファイル: Dictionary.cs プロジェクト: YeldhamDev/godot
        public void Dispose(bool disposing)
        {
            // Always dispose `NativeValue` even if disposing is true
            NativeValue.DangerousSelfRef.Dispose();

            if (_weakReferenceToSelf != null)
            {
                DisposablesTracker.UnregisterDisposable(_weakReferenceToSelf);
            }
        }
コード例 #3
0
        public Array(Span <NodePath> array) : this()
        {
            if (array == null)
            {
                throw new ArgumentNullException(nameof(array));
            }

            NativeValue          = (godot_array.movable)NativeFuncs.godotsharp_array_new();
            _weakReferenceToSelf = DisposablesTracker.RegisterDisposable(this);

            int length = array.Length;

            Resize(length);

            for (int i = 0; i < length; i++)
            {
                this[i] = array[i];
            }
        }
コード例 #4
0
ファイル: Dictionary.cs プロジェクト: YeldhamDev/godot
 /// <summary>
 /// Constructs a new empty <see cref="Dictionary"/>.
 /// </summary>
 public Dictionary()
 {
     NativeValue          = (godot_dictionary.movable)NativeFuncs.godotsharp_dictionary_new();
     _weakReferenceToSelf = DisposablesTracker.RegisterDisposable(this);
 }
コード例 #5
0
 /// <summary>
 /// Constructs a new empty <see cref="Array"/>.
 /// </summary>
 public Array()
 {
     NativeValue          = (godot_array.movable)NativeFuncs.godotsharp_array_new();
     _weakReferenceToSelf = DisposablesTracker.RegisterDisposable(this);
 }