public void UpdateHeldBlock(BlockGameBlock[] blocks) { _holdBlockGrid.RemoveAllChildren(); if (blocks.Length == 0) { return; } var columnCount = blocks.Max(b => b.Position.X) + 1; var rowCount = blocks.Max(b => b.Position.Y) + 1; _holdBlockGrid.Columns = columnCount; for (int y = 0; y < rowCount; y++) { for (int x = 0; x < columnCount; x++) { var c = GetColorForPosition(blocks, x, y); _holdBlockGrid.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = c }, CustomMinimumSize = blockSize, RectDrawClipMargin = 0 }); } } }
private void RefreshList() { // Clear _grid.RemoveAllChildren(); if (_decals == null) { return; } var filter = _search.Text; foreach (var(decal, tex) in _decals) { if (!decal.Contains(filter)) { continue; } var button = new TextureButton() { TextureNormal = tex, Name = decal, ToolTip = decal, Modulate = _color }; button.OnPressed += ButtonOnPressed; if (_selected == decal) { var panelContainer = new PanelContainer() { PanelOverride = new StyleBoxFlat() { BackgroundColor = StyleNano.ButtonColorDefault, }, Children = { button } }; _grid.AddChild(panelContainer); } else { _grid.AddChild(button); } } }
public void UpdateBlocks(BlockGameBlock[] blocks) { _gameGrid.RemoveAllChildren(); for (int y = 0; y < 20; y++) { for (int x = 0; x < 10; x++) { var c = GetColorForPosition(blocks, x, y); _gameGrid.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = c }, CustomMinimumSize = blockSize, RectDrawClipMargin = 0 }); } } }