mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-22 16:20:19 +01:00
Rename CommitMessage to TextEditor, because it's more general now
This commit is contained in:
parent
078c1612ac
commit
8a6f957c61
2 changed files with 13 additions and 15 deletions
22
main.gd
22
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():
|
||||
|
|
|
@ -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"]
|
||||
|
|
Loading…
Reference in a new issue