private ConstructionSystem? _constructionSystem;
private ConstructionPrototype? _selected;
private List<ConstructionPrototype> _favoritedRecipes = [];
- private Dictionary<string, ContainerButton> _recipeButtons = new();
+ private readonly Dictionary<string, ContainerButton> _recipeButtons = new();
private string _selectedCategory = string.Empty;
private const string FavoriteCatName = "construction-category-favorites";
var itemButton = new ContainerButton()
{
VerticalAlignment = Control.VAlignment.Center,
- Name = recipe.TargetPrototype.Name,
- ToolTip = recipe.TargetPrototype.Name,
+ Name = recipe.Prototype.Name,
+ ToolTip = recipe.Prototype.Name,
ToggleMode = true,
Children = { protoView },
};
if (buttonToggledEventArgs.Pressed &&
_selected != null &&
- _recipeButtons.TryGetValue(_selected.Name!, out var oldButton))
+ _recipeButtons.TryGetValue(_selected.ID, out var oldButton))
{
oldButton.Pressed = false;
SelectGridButton(oldButton, false);
};
recipesGrid.AddChild(itemButtonPanelContainer);
- _recipeButtons[recipe.Prototype.Name!] = itemButton;
+ _recipeButtons[recipe.Prototype.ID] = itemButton;
var isCurrentButtonSelected = _selected == recipe.Prototype;
itemButton.Pressed = isCurrentButtonSelected;
SelectGridButton(itemButton, isCurrentButtonSelected);
if (button.Parent is not PanelContainer buttonPanel)
return;
- button.Modulate = select ? Color.Green : Color.Transparent;
+ button.Children.Single().Modulate = select ? Color.Green : Color.White;
var buttonColor = select ? StyleNano.ButtonColorDefault : Color.Transparent;
buttonPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = buttonColor };
}