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):
|
func _process(_delta):
|
||||||
if server.is_connection_available():
|
if server.is_connection_available():
|
||||||
print("Client connected")
|
|
||||||
client_connection = server.take_connection()
|
client_connection = server.take_connection()
|
||||||
var length = client_connection.get_u8()
|
var length = client_connection.get_u8()
|
||||||
var filename = client_connection.get_string(length)
|
var filename = client_connection.get_string(length)
|
||||||
var regex = RegEx.new()
|
var regex = RegEx.new()
|
||||||
regex.compile("(\\.git\\/.*)")
|
regex.compile("(\\.git\\/.*)")
|
||||||
filename = regex.search(filename).get_string()
|
filename = regex.search(filename).get_string()
|
||||||
print(filename)
|
read_message(filename)
|
||||||
read_commit_message(filename)
|
|
||||||
|
|
||||||
func read_commit_message(filename):
|
func read_message(filename):
|
||||||
$CommitMessage.show()
|
$TextEditor.show()
|
||||||
input.editable = false
|
input.editable = false
|
||||||
var fixme_path = game.tmp_prefix+"/active/"
|
var fixme_path = game.tmp_prefix+"/active/"
|
||||||
$CommitMessage.text = game.read_file(fixme_path+filename)
|
$TextEditor.text = game.read_file(fixme_path+filename)
|
||||||
$CommitMessage.path = filename
|
$TextEditor.path = filename
|
||||||
$CommitMessage.grab_focus()
|
$TextEditor.grab_focus()
|
||||||
|
|
||||||
func save_commit_message():
|
func save_message():
|
||||||
var fixme_path = game.tmp_prefix+"/active/"
|
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()
|
client_connection.disconnect_from_host()
|
||||||
input.editable = true
|
input.editable = true
|
||||||
$CommitMessage.text = ""
|
$TextEditor.text = ""
|
||||||
$CommitMessage.hide()
|
$TextEditor.hide()
|
||||||
input.grab_focus()
|
input.grab_focus()
|
||||||
|
|
||||||
func show_win_status():
|
func show_win_status():
|
||||||
|
|
|
@ -34,7 +34,7 @@ margin_top = 484.0
|
||||||
margin_right = 1898.0
|
margin_right = 1898.0
|
||||||
margin_bottom = 1059.0
|
margin_bottom = 1059.0
|
||||||
|
|
||||||
[node name="CommitMessage" type="TextEdit" parent="."]
|
[node name="TextEditor" type="TextEdit" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
margin_left = 1209.0
|
margin_left = 1209.0
|
||||||
margin_top = 484.0
|
margin_top = 484.0
|
||||||
|
@ -48,7 +48,7 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="SaveButton" type="Button" parent="CommitMessage"]
|
[node name="SaveButton" type="Button" parent="TextEditor"]
|
||||||
margin_left = 540.661
|
margin_left = 540.661
|
||||||
margin_top = 528.031
|
margin_top = 528.031
|
||||||
margin_right = 689.661
|
margin_right = 689.661
|
||||||
|
@ -130,5 +130,5 @@ text = "Next Level"
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_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"]
|
[connection signal="pressed" from="NextLevelButton" to="." method="load_next_level"]
|
||||||
|
|
Loading…
Reference in a new issue