-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a81ee0
commit b675563
Showing
6 changed files
with
99 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Blocktest.Block_System; | ||
using Blocktest.Scenes; | ||
using Myra.Graphics2D; | ||
using Myra.Graphics2D.UI; | ||
using Shared.Code.Block_System; | ||
|
||
namespace Blocktest.UI; | ||
|
||
public sealed class GameUI : Grid { | ||
public ComboBox BlockSelector; | ||
|
||
public GameUI(GameScene scene) { | ||
BlockSelector = new ComboBox { | ||
GridColumn = 0, | ||
GridRow = 0, | ||
Width = 200, | ||
Height = 40, | ||
Padding = new Thickness(5) | ||
}; | ||
|
||
foreach (var block in BlockManagerShared.AllBlocks) { | ||
var blockItem = new ListItem { | ||
Text = block.Value.BlockName, | ||
Image = BlockSpritesManager.AllBlocksSprites[block.Key].BlockSprite, | ||
Id = block.Key | ||
}; | ||
BlockSelector.Items.Add(blockItem); | ||
} | ||
BlockSelector.SelectedIndexChanged += (_, _) => { | ||
scene.BlockSelected = BlockSelector.SelectedIndex ?? 0; | ||
}; | ||
BlockSelector.SelectedIndex = scene.BlockSelected; | ||
|
||
Widgets.Add(BlockSelector); | ||
|
||
var buildMode = new CheckBox { | ||
GridColumn = 1, | ||
GridRow = 0, | ||
Text = "Build Mode", | ||
Width = 200, | ||
Height = 40, | ||
Padding = new Thickness(5), | ||
IsChecked = scene.BuildMode | ||
}; | ||
buildMode.TouchDown += (_, _) => { | ||
scene.SetBuildMode(!buildMode.IsChecked); | ||
}; | ||
|
||
Widgets.Add(buildMode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters