31 lines
577 B
C#
31 lines
577 B
C#
using Godot;
|
|
|
|
namespace KeepersCompound.TMV.UI;
|
|
|
|
public partial class LightmapLayerToggler : Control
|
|
{
|
|
public void Setup(Mission mission)
|
|
{
|
|
var layersNode = GetNode<GridContainer>("%Layers");
|
|
foreach (var node in layersNode.GetChildren())
|
|
{
|
|
node.QueueFree();
|
|
}
|
|
|
|
var layerCount = mission.LightmapLayers;
|
|
for (var i = 0; i < layerCount; i++)
|
|
{
|
|
var button = new Button
|
|
{
|
|
Text = i.ToString(),
|
|
ToggleMode = true
|
|
};
|
|
button.Pressed += () =>
|
|
{
|
|
mission.ToggleLmLayer(uint.Parse(button.Text));
|
|
};
|
|
layersNode.AddChild(button);
|
|
}
|
|
}
|
|
}
|