From 8a6f957c6161c607cac47c9b163c9347c40c4abd Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Sun, 13 Sep 2020 18:44:27 +0200 Subject: [PATCH] Rename CommitMessage to TextEditor, because it's more general now --- main.gd | 22 ++++++++++------------ main.tscn | 6 +++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/main.gd b/main.gd index 4aa647d..bf5102e 100644 --- a/main.gd +++ b/main.gd @@ -106,31 +106,29 @@ func construct_repo(script, path): func _process(_delta): if server.is_connection_available(): - print("Client connected") client_connection = server.take_connection() var length = client_connection.get_u8() var filename = client_connection.get_string(length) var regex = RegEx.new() regex.compile("(\\.git\\/.*)") filename = regex.search(filename).get_string() - print(filename) - read_commit_message(filename) + read_message(filename) -func read_commit_message(filename): - $CommitMessage.show() +func read_message(filename): + $TextEditor.show() input.editable = false var fixme_path = game.tmp_prefix+"/active/" - $CommitMessage.text = game.read_file(fixme_path+filename) - $CommitMessage.path = filename - $CommitMessage.grab_focus() + $TextEditor.text = game.read_file(fixme_path+filename) + $TextEditor.path = filename + $TextEditor.grab_focus() -func save_commit_message(): +func save_message(): var fixme_path = game.tmp_prefix+"/active/" - game.write_file(fixme_path+$CommitMessage.path, $CommitMessage.text) + game.write_file(fixme_path+$TextEditor.path, $TextEditor.text) client_connection.disconnect_from_host() input.editable = true - $CommitMessage.text = "" - $CommitMessage.hide() + $TextEditor.text = "" + $TextEditor.hide() input.grab_focus() func show_win_status(): diff --git a/main.tscn b/main.tscn index c1a2b64..449d3e7 100644 --- a/main.tscn +++ b/main.tscn @@ -34,7 +34,7 @@ margin_top = 484.0 margin_right = 1898.0 margin_bottom = 1059.0 -[node name="CommitMessage" type="TextEdit" parent="."] +[node name="TextEditor" type="TextEdit" parent="."] visible = false margin_left = 1209.0 margin_top = 484.0 @@ -48,7 +48,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="SaveButton" type="Button" parent="CommitMessage"] +[node name="SaveButton" type="Button" parent="TextEditor"] margin_left = 540.661 margin_top = 528.031 margin_right = 689.661 @@ -130,5 +130,5 @@ text = "Next Level" __meta__ = { "_edit_use_anchors_": false } -[connection signal="pressed" from="CommitMessage/SaveButton" to="." method="save_commit_message"] +[connection signal="pressed" from="TextEditor/SaveButton" to="." method="save_message"] [connection signal="pressed" from="NextLevelButton" to="." method="load_next_level"]