Tweaked DebugStats UI.

WorldChunkRefactoring
Martin Felis 2023-08-13 21:08:12 +02:00
parent d963c90912
commit 6c0bff1de1
2 changed files with 71 additions and 53 deletions

View File

@ -11,7 +11,8 @@ public class Game : Spatial
private Label _tileOffsetLabel;
private Label _numTilesLabel;
private Label _mouseWorldLabel;
private Label _mouseTileLabel;
private Label _mouseTileOffsetLabel;
private Label _mouseTileCubeLabel;
private Label _numCoordsAddedLabel;
private Label _numCoordsRemovedLabel;
private TextureRect _worldTextureRect;
@ -53,7 +54,8 @@ public class Game : Spatial
_tileOffsetLabel = debugStatsContainer.GetNode<Label>("tile_offset_label");
_numTilesLabel = debugStatsContainer.GetNode<Label>("num_tiles_label");
_mouseWorldLabel = debugStatsContainer.GetNode<Label>("mouse_world_label");
_mouseTileLabel = debugStatsContainer.GetNode<Label>("mouse_tile_label");
_mouseTileOffsetLabel = debugStatsContainer.GetNode<Label>("mouse_tile_offset_label");
_mouseTileCubeLabel = debugStatsContainer.GetNode<Label>("mouse_tile_cube_label");
_numCoordsAddedLabel = debugStatsContainer.GetNode<Label>("num_coords_added_label");
_numCoordsRemovedLabel = debugStatsContainer.GetNode<Label>("num_coords_removed_label");
@ -235,7 +237,8 @@ public class Game : Spatial
Transform highlightTransform = Transform.Identity;
_mouseWorldLabel.Text = position.ToString();
_mouseTileLabel.Text = cellAtCursor.OffsetCoords.ToString();
_mouseTileOffsetLabel.Text = cellAtCursor.OffsetCoords.ToString();
_mouseTileCubeLabel.Text = cellAtCursor.CubeCoords.ToString();
_mouseTileHighlight.Transform = highlightTransform;
if (inputEvent is InputEventMouseButton && ((InputEventMouseButton)inputEvent).Pressed)
@ -267,8 +270,9 @@ public class Game : Spatial
Transform highlightTransform = tile.GlobalTransform;
highlightTransform.origin.y += 0.1f;
_mouseTileHighlight.Transform = highlightTransform;
_mouseWorldLabel.Text = tile.GlobalTranslation.ToString();
_mouseTileLabel.Text = tile.OffsetCoords.ToString();
_mouseWorldLabel.Text = highlightTransform.origin.ToString();
_mouseTileOffsetLabel.Text = tile.OffsetCoords.ToString();
_mouseTileCubeLabel.Text = tile.Cell.CubeCoords.ToString();
_player.Navigation.FindPath(_player, _player.GlobalTranslation, tile.GlobalTranslation);
}

View File

@ -34,10 +34,9 @@ script = ExtResource( 9 )
[node name="TileHighlight" parent="." instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 )
visible = false
[node name="MouseTileHighlight" parent="." instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.3, 0 )
[node name="TileWorld" parent="." instance=ExtResource( 8 )]
GenerationMapType = 0
@ -81,136 +80,151 @@ margin_left = -141.0
margin_top = -172.0
grow_horizontal = 0
grow_vertical = 0
mouse_filter = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="DebugStatsContainer" type="GridContainer" parent="DebugContainer"]
margin_left = 7.0
margin_top = 7.0
margin_right = 134.0
margin_bottom = 165.0
margin_right = 156.0
margin_bottom = 183.0
grow_horizontal = 0
grow_vertical = 0
mouse_filter = 2
columns = 2
[node name="Label9" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_right = 103.0
margin_right = 113.0
margin_bottom = 14.0
rect_pivot_offset = Vector2( -335, -33 )
text = "FPS"
[node name="fps_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 107.0
margin_right = 127.0
margin_left = 117.0
margin_right = 149.0
margin_bottom = 14.0
text = "0,0"
[node name="Label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_top = 18.0
margin_right = 103.0
margin_right = 113.0
margin_bottom = 32.0
rect_pivot_offset = Vector2( -335, -33 )
text = "Tile"
[node name="tile_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 107.0
margin_left = 117.0
margin_top = 18.0
margin_right = 127.0
margin_right = 149.0
margin_bottom = 32.0
text = "0,0"
[node name="Label2" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_top = 36.0
margin_right = 103.0
margin_right = 113.0
margin_bottom = 50.0
text = "Tile Offset"
[node name="tile_offset_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 107.0
margin_left = 117.0
margin_top = 36.0
margin_right = 127.0
margin_right = 149.0
margin_bottom = 50.0
text = "0,0"
[node name="Label4" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_top = 54.0
margin_right = 103.0
margin_right = 113.0
margin_bottom = 68.0
rect_pivot_offset = Vector2( -335, -33 )
text = "Mouse World"
[node name="mouse_world_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 107.0
margin_left = 117.0
margin_top = 54.0
margin_right = 127.0
margin_right = 149.0
margin_bottom = 68.0
text = "0,0"
[node name="Label6" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_top = 72.0
margin_right = 103.0
margin_right = 113.0
margin_bottom = 86.0
rect_pivot_offset = Vector2( -335, -33 )
text = "Mouse Tile"
text = "Mouse Tile Offset"
[node name="mouse_tile_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 107.0
[node name="mouse_tile_offset_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 117.0
margin_top = 72.0
margin_right = 127.0
margin_right = 149.0
margin_bottom = 86.0
text = "0,0"
[node name="Label3" type="Label" parent="DebugContainer/DebugStatsContainer"]
[node name="Label10" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_top = 90.0
margin_right = 103.0
margin_right = 113.0
margin_bottom = 104.0
rect_pivot_offset = Vector2( -335, -33 )
text = "Mouse Tile Cube"
[node name="mouse_tile_cube_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 117.0
margin_top = 90.0
margin_right = 149.0
margin_bottom = 104.0
text = "0,0,0"
[node name="Label3" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_top = 108.0
margin_right = 113.0
margin_bottom = 122.0
text = "#Tiles"
[node name="num_tiles_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 107.0
margin_top = 90.0
margin_right = 127.0
margin_bottom = 104.0
margin_left = 117.0
margin_top = 108.0
margin_right = 149.0
margin_bottom = 122.0
text = "0"
[node name="Label5" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_top = 108.0
margin_right = 103.0
margin_bottom = 122.0
margin_top = 126.0
margin_right = 113.0
margin_bottom = 140.0
text = "#Active"
[node name="num_active_tiles_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 107.0
margin_top = 108.0
margin_right = 127.0
margin_bottom = 122.0
margin_left = 117.0
margin_top = 126.0
margin_right = 149.0
margin_bottom = 140.0
text = "0"
[node name="Label7" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_top = 126.0
margin_right = 103.0
margin_bottom = 140.0
margin_top = 144.0
margin_right = 113.0
margin_bottom = 158.0
text = "#Tiles Added"
[node name="num_coords_added_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 107.0
margin_top = 126.0
margin_right = 127.0
margin_bottom = 140.0
margin_left = 117.0
margin_top = 144.0
margin_right = 149.0
margin_bottom = 158.0
text = "0"
[node name="Label8" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_top = 144.0
margin_right = 103.0
margin_bottom = 158.0
margin_top = 162.0
margin_right = 113.0
margin_bottom = 176.0
text = "#Tiles Removed"
[node name="num_coords_removed_label" type="Label" parent="DebugContainer/DebugStatsContainer"]
margin_left = 107.0
margin_top = 144.0
margin_right = 127.0
margin_bottom = 158.0
margin_left = 117.0
margin_top = 162.0
margin_right = 149.0
margin_bottom = 176.0
text = "0"
[node name="Generator Container" type="Control" parent="."]