|
| 1 | +using Godot; |
| 2 | +using Godot.NativeInterop; |
| 3 | + |
| 4 | +partial class AbstractGenericNode<T> |
| 5 | +{ |
| 6 | +#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword |
| 7 | + /// <summary> |
| 8 | + /// Cached StringNames for the properties and fields contained in this class, for fast lookup. |
| 9 | + /// </summary> |
| 10 | + public new class PropertyName : global::Godot.Node.PropertyName { |
| 11 | + /// <summary> |
| 12 | + /// Cached name for the 'MyArray' property. |
| 13 | + /// </summary> |
| 14 | + public new static readonly global::Godot.StringName MyArray = "MyArray"; |
| 15 | + } |
| 16 | + /// <inheritdoc/> |
| 17 | + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] |
| 18 | + protected override bool SetGodotClassPropertyValue(in godot_string_name name, in godot_variant value) |
| 19 | + { |
| 20 | + if (name == PropertyName.MyArray) { |
| 21 | + this.MyArray = global::Godot.NativeInterop.VariantUtils.ConvertToArray<T>(value); |
| 22 | + return true; |
| 23 | + } |
| 24 | + return base.SetGodotClassPropertyValue(name, value); |
| 25 | + } |
| 26 | + /// <inheritdoc/> |
| 27 | + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] |
| 28 | + protected override bool GetGodotClassPropertyValue(in godot_string_name name, out godot_variant value) |
| 29 | + { |
| 30 | + if (name == PropertyName.MyArray) { |
| 31 | + value = global::Godot.NativeInterop.VariantUtils.CreateFromArray(this.MyArray); |
| 32 | + return true; |
| 33 | + } |
| 34 | + return base.GetGodotClassPropertyValue(name, out value); |
| 35 | + } |
| 36 | + /// <summary> |
| 37 | + /// Get the property information for all the properties declared in this class. |
| 38 | + /// This method is used by Godot to register the available properties in the editor. |
| 39 | + /// Do not call this method. |
| 40 | + /// </summary> |
| 41 | + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] |
| 42 | + internal new static global::System.Collections.Generic.List<global::Godot.Bridge.PropertyInfo> GetGodotPropertyList() |
| 43 | + { |
| 44 | + var properties = new global::System.Collections.Generic.List<global::Godot.Bridge.PropertyInfo>(); |
| 45 | + properties.Add(new(type: (global::Godot.Variant.Type)28, name: PropertyName.MyArray, hint: (global::Godot.PropertyHint)0, hintString: "", usage: (global::Godot.PropertyUsageFlags)4102, exported: true)); |
| 46 | + return properties; |
| 47 | + } |
| 48 | +#pragma warning restore CS0109 |
| 49 | +} |
0 commit comments