finishing touches for console

This commit is contained in:
2023-02-19 13:38:53 +01:00
parent 6e8dcba561
commit 14c9458805
4 changed files with 19 additions and 17 deletions

View File

@@ -122,7 +122,7 @@ hotkey_fullscreen={
}
console={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194334,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194334,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}

View File

@@ -2,24 +2,26 @@
[ext_resource type="Script" path="res://src/scene-scripts/console.cs" id="1_c6bre"]
[node name="console" type="CanvasLayer"]
[node name="popup_panel" type="PopupPanel"]
transparent_bg = true
size = Vector2i(1537, 193)
visible = true
script = ExtResource("1_c6bre")
[node name="panel_container" type="PanelContainer" parent="."]
anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
[node name="v_box_container" type="VBoxContainer" parent="."]
offset_left = 4.0
offset_top = 4.0
offset_right = 1533.0
offset_bottom = 189.0
[node name="v_box_container" type="VBoxContainer" parent="panel_container"]
layout_mode = 2
[node name="rich_text_label" type="RichTextLabel" parent="panel_container/v_box_container"]
[node name="rich_text_label" type="RichTextLabel" parent="v_box_container"]
custom_minimum_size = Vector2(0, 150)
layout_mode = 2
bbcode_enabled = true
text = "[color=red][b]USING CHEATS MAY DISABLE ACHIEVEMENTS[/b][/color]"
scroll_following = true
[node name="line_edit" type="LineEdit" parent="panel_container/v_box_container"]
[node name="line_edit" type="LineEdit" parent="v_box_container"]
layout_mode = 2
placeholder_text = "Type in cheat or command. Use \"help\" for help."
max_length = 200
@@ -30,5 +32,3 @@ select_all_on_focus = true
caret_blink = true
caret_blink_interval = 0.5
caret_force_displayed = true
[connection signal="text_submitted" from="panel_container/v_box_container/line_edit" to="." method="OnLineEditTextSubmitted"]

View File

@@ -142,4 +142,3 @@ shape = SubResource("CapsuleShape2D_38v5o")
metadata/_edit_lock_ = true
[node name="console" parent="." instance=ExtResource("4_kw3hh")]
visible = false

View File

@@ -1,14 +1,17 @@
using Godot;
public partial class console : CanvasLayer
public partial class console : PopupPanel
{
public RichTextLabel textblock;
public LineEdit line;
public string error = "Not found! :(";
//functions with capital letters can't be used inside the console
public override void _Ready()
{
textblock = GetNode<RichTextLabel>("panel_container/v_box_container/rich_text_label");
line = GetNode<LineEdit>("panel_container/v_box_container/line_edit");
textblock = GetNode<RichTextLabel>("v_box_container/rich_text_label");
line = GetNode<LineEdit>("v_box_container/line_edit");
}
public override void _Process(double delta)
{