32 lines
604 B
C#
32 lines
604 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class CYSFocusSetup : Node
|
|
{
|
|
[Export] private GridContainer grid;
|
|
[Export] private Button button;
|
|
[Export] private ScrollContainer textContainer;
|
|
public override void _Ready()
|
|
{
|
|
for (int i = 0; i < grid.GetChildCount(); i++)
|
|
{
|
|
int x = i % grid.Columns;
|
|
int y = i / grid.Columns;
|
|
|
|
Control control = grid.GetChild<Control>(i);
|
|
|
|
if (y == 0)
|
|
{
|
|
control.FocusNeighborTop = control.GetPathTo(textContainer);
|
|
}
|
|
if (x == grid.Columns - 1)
|
|
{
|
|
control.FocusNeighborRight = control.GetPathTo(button);
|
|
}
|
|
|
|
}
|
|
|
|
QueueFree();
|
|
}
|
|
|
|
}
|