private static Button AddButton(string text, Control parent, DebugMenuAction action) { Button btn = new Button(); btn.Text = text; btn.SizeFlagsHorizontal = (int)SizeFlags.Expand + (int)SizeFlags.Fill; Instance.ActionList.Add(action); Godot.Collections.Array parameters = new Godot.Collections.Array(); parameters.Add(Instance.ActionList.Count - 1); btn.Connect("pressed", Instance, nameof(ButtonPressed), parameters); parent.AddChild(btn); return(btn); }
public static void AddActionButton(string text, Node node, DebugMenuAction action) { Button btn = AddButton(text, Instance.ActionGridParent, action); Instance.RegisterActionButton(node, btn); }