2025-01-03 12:09:23 +00:00
|
|
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System;
|
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
{
|
|
|
|
public class Selectors
|
|
|
|
{
|
2025-01-08 18:46:17 +00:00
|
|
|
public static T GetFromDirectChildren<T>( Node parent, Selector s ) where T:Node
|
2025-01-03 12:09:23 +00:00
|
|
|
{
|
|
|
|
T selected = null;
|
|
|
|
|
|
|
|
Nodes.ForEachDirectChild<T>( parent,
|
|
|
|
( T t )=>
|
|
|
|
{
|
|
|
|
if ( selected != null )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( s != null && s.Selects( t ) )
|
|
|
|
{
|
|
|
|
selected = t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
return selected;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|