hotbar resize
This commit is contained in:
parent
27d839b86f
commit
1cd9ef3f3a
9 changed files with 55 additions and 23 deletions
24
scripts/gui/PlantHotbarSize.cs
Normal file
24
scripts/gui/PlantHotbarSize.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
using System;
|
||||
|
||||
public partial class PlantHotbarSize : PanelContainer
|
||||
{
|
||||
const int MARGIN = 4;
|
||||
const int PACKET_WIDTH = 41;
|
||||
const int MINIMUM_Y = 64;
|
||||
public override void _Ready()
|
||||
{
|
||||
CustomMinimumSize = new Vector2(MARGIN * 2 + PACKET_WIDTH * PlayerProgress.Instance.MaxSeedpackets, MINIMUM_Y);
|
||||
|
||||
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
|
||||
}
|
||||
|
||||
public void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
||||
{
|
||||
if (state != RuntimeLevelData.LevelStates.ChooseYourSeeds)
|
||||
{
|
||||
CustomMinimumSize = new Vector2(0, MINIMUM_Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue