public StringName Name { get { return GetName(); } set { SetName(value); } }
// // 摘要: // Sets this node's name as a unique name in its Godot.Node.Owner. This allows the // node to be accessed as %Name instead of the full path, from any node within that // scene. // // If another node with the same owner already had that name declared as unique, // that other node's name will no longer be set as having a unique name. publicbool UniqueNameInOwner { get { return IsUniqueNameInOwner(); } set { SetUniqueNameInOwner(value); } }
// // 摘要: // Emitted when a child node is about to exit the scene tree, either because it // is being removed or freed directly, or because this node is exiting the tree. // // // When this signal is received, the child node is still in the tree and valid. // This signal is emitted after the child node's own Godot.Node.TreeExiting and // Godot.Node.NotificationExitTree. publicunsafeevent ChildExitingTreeEventHandler ChildExitingTree { add { Connect(SignalName.ChildExitingTree, Callable.CreateWithUnsafeTrampoline((Delegate)value, (delegate*<object, NativeVariantPtrArgs, out godot_variant, void>)(&ChildExitingTreeTrampoline))); } remove { Disconnect(SignalName.ChildExitingTree, Callable.CreateWithUnsafeTrampoline((Delegate)value, (delegate*<object, NativeVariantPtrArgs, out godot_variant, void>)(&ChildExitingTreeTrampoline))); } }
方法实现
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
public T GetNode<T>(NodePath path) where T : class { return (T)(object)GetNode(path); }
public T GetNodeOrNull<T>(NodePath path) where T : class { return GetNodeOrNull(path) as T; }
public T GetChild<T>(int idx, bool includeInternal = false) where T : class { return (T)(object)GetChild(idx, includeInternal); }
1 2 3 4 5 6 7
publicvirtualvoid _EnterTree() { }
publicvirtualvoid _ExitTree() { }
字典初始化
示例 1:使用构造函数初始化一个空的 Dictionary
1
Dictionary<string, int> dictionary = new Dictionary<string, int>();
List<Tuple<string, int>> list = new List<Tuple<string, int>> { new Tuple<string, int>("apple", 1), new Tuple<string, int>("banana", 2), new Tuple<string, int>("cherry", 3) };
List<Fruit> fruits = new List<Fruit> { new Fruit { Name = "apple", Quantity = 1 }, new Fruit { Name = "banana", Quantity = 2 }, new Fruit { Name = "cherry", Quantity = 3 } };
Dictionary<string, int> dictionary = fruits.ToDictionary(fruit => fruit.Name, fruit => fruit.Quantity);