#region Sidebar
_sidebar.Children.Clear();
- _sidebar.Rows = boundingGrid.Height + 1;
+ var rows = boundingGrid.Height + 1;
+ _sidebar.Rows = rows;
var exitButton = new TextureButton
{
};
_sidebar.AddChild(exitContainer);
- var offset = 1;
+ var offset = 2;
- if (_entity.System<StorageSystem>().NestedStorage && boundingGrid.Height > 0)
+ if (_entity.System<StorageSystem>().NestedStorage && rows > 0)
{
- offset += 1;
-
_backButton = new TextureButton
{
TextureNormal = _backTexture,
{
new TextureRect
{
- Texture = boundingGrid.Height > 2 ? _sidebarMiddleTexture : _sidebarBottomTexture,
+ Texture = rows > 2 ? _sidebarMiddleTexture : _sidebarBottomTexture,
TextureScale = new Vector2(2, 2),
Children =
{
_sidebar.AddChild(backContainer);
}
- var rows = boundingGrid.Height - offset;
-
- for (var i = 0; i < rows; i++)
- {
- _sidebar.AddChild(new TextureRect
- {
- Texture = _sidebarMiddleTexture,
- TextureScale = new Vector2(2, 2),
- });
- }
+ var fillerRows = rows - offset;
- if (rows > 0)
+ for (var i = 0; i < fillerRows; i++)
{
_sidebar.AddChild(new TextureRect
{
- Texture = _sidebarBottomTexture,
+ Texture = i != (fillerRows - 1) ? _sidebarMiddleTexture : _sidebarBottomTexture,
TextureScale = new Vector2(2, 2),
});
}