mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
Put TextEditor into Terminal scene
This commit is contained in:
parent
b2ac12c4ed
commit
3cfd6ec710
3 changed files with 22 additions and 14 deletions
16
main.tscn
16
main.tscn
|
@ -1,11 +1,10 @@
|
||||||
[gd_scene load_steps=11 format=2]
|
[gd_scene load_steps=10 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://terminal.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://terminal.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://main.gd" type="Script" id=2]
|
[ext_resource path="res://main.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://repository.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://repository.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://styles/alert_button.tres" type="StyleBox" id=4]
|
[ext_resource path="res://styles/alert_button.tres" type="StyleBox" id=4]
|
||||||
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=5]
|
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=5]
|
||||||
[ext_resource path="res://text_editor.tscn" type="PackedScene" id=6]
|
|
||||||
[ext_resource path="res://fonts/big.tres" type="DynamicFont" id=7]
|
[ext_resource path="res://fonts/big.tres" type="DynamicFont" id=7]
|
||||||
[ext_resource path="res://tcp_server.gd" type="Script" id=8]
|
[ext_resource path="res://tcp_server.gd" type="Script" id=8]
|
||||||
[ext_resource path="res://test.gd" type="Script" id=9]
|
[ext_resource path="res://test.gd" type="Script" id=9]
|
||||||
|
@ -24,7 +23,7 @@ script = ExtResource( 2 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
terminal_path = NodePath("HBoxContainer/RightSide/InputArea/Terminal")
|
terminal_path = NodePath("HBoxContainer/RightSide/Terminal")
|
||||||
goal_repository_path = NodePath("HBoxContainer/Repositories/GoalRepository")
|
goal_repository_path = NodePath("HBoxContainer/Repositories/GoalRepository")
|
||||||
active_repository_path = NodePath("HBoxContainer/Repositories/ActiveRepository")
|
active_repository_path = NodePath("HBoxContainer/Repositories/ActiveRepository")
|
||||||
level_select_path = NodePath("HBoxContainer/RightSide/Menu/LevelSelect")
|
level_select_path = NodePath("HBoxContainer/RightSide/Menu/LevelSelect")
|
||||||
|
@ -171,17 +170,14 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="InputArea" type="Control" parent="HBoxContainer/RightSide"]
|
[node name="Terminal" parent="HBoxContainer/RightSide" instance=ExtResource( 1 )]
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
margin_top = 560.0
|
margin_top = 560.0
|
||||||
margin_right = 639.0
|
margin_right = 639.0
|
||||||
margin_bottom = 1080.0
|
margin_bottom = 1080.0
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
repository_path = NodePath("../../Repositories/ActiveRepository")
|
||||||
[node name="Terminal" parent="HBoxContainer/RightSide/InputArea" instance=ExtResource( 1 )]
|
|
||||||
repository_path = NodePath("../../../Repositories/ActiveRepository")
|
|
||||||
|
|
||||||
[node name="TextEditor" parent="HBoxContainer/RightSide/InputArea" instance=ExtResource( 6 )]
|
|
||||||
visible = false
|
|
||||||
|
|
||||||
[node name="Test" type="Node2D" parent="."]
|
[node name="Test" type="Node2D" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
|
@ -11,7 +11,6 @@ export(NodePath) var repository_path
|
||||||
onready var repository = get_node(repository_path)
|
onready var repository = get_node(repository_path)
|
||||||
onready var command_dropdown = $Control/InputLine/CommandDropdown
|
onready var command_dropdown = $Control/InputLine/CommandDropdown
|
||||||
onready var main = get_tree().get_root().get_node("Main")
|
onready var main = get_tree().get_root().get_node("Main")
|
||||||
onready var text_editor = $"../TextEditor"
|
|
||||||
|
|
||||||
var premade_commands = [
|
var premade_commands = [
|
||||||
'git commit --allow-empty -m "empty"',
|
'git commit --allow-empty -m "empty"',
|
||||||
|
@ -29,8 +28,6 @@ func _ready():
|
||||||
command_dropdown.theme.default_font = load("res://fonts/default.tres")
|
command_dropdown.theme.default_font = load("res://fonts/default.tres")
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventKey and not text_editor.visible:
|
|
||||||
input.grab_focus()
|
|
||||||
if history.size() > 0:
|
if history.size() > 0:
|
||||||
if event.is_action_pressed("ui_up"):
|
if event.is_action_pressed("ui_up"):
|
||||||
if history_position > 0:
|
if history_position > 0:
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1]
|
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1]
|
||||||
[ext_resource path="res://terminal.gd" type="Script" id=2]
|
[ext_resource path="res://terminal.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://styles/terminal_input.tres" type="StyleBox" id=3]
|
[ext_resource path="res://styles/terminal_input.tres" type="StyleBox" id=3]
|
||||||
|
[ext_resource path="res://text_editor.gd" type="Script" id=4]
|
||||||
|
[ext_resource path="res://text_editor.tscn" type="PackedScene" id=5]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id=1]
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
bg_color = Color( 0, 0, 0, 1 )
|
bg_color = Color( 0, 0, 0, 1 )
|
||||||
|
@ -77,5 +79,18 @@ margin_top = 10.0
|
||||||
margin_right = -10.0
|
margin_right = -10.0
|
||||||
custom_fonts/font = ExtResource( 1 )
|
custom_fonts/font = ExtResource( 1 )
|
||||||
text = "Clear"
|
text = "Clear"
|
||||||
|
|
||||||
|
[node name="TextEditor" type="TextEdit" parent="." instance=ExtResource( 5 )]
|
||||||
|
visible = false
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
custom_fonts/font = ExtResource( 1 )
|
||||||
|
custom_colors/background_color = Color( 0, 0, 0, 1 )
|
||||||
|
text = "Text here"
|
||||||
|
syntax_highlighting = true
|
||||||
|
script = ExtResource( 4 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
[connection signal="text_entered" from="Control/InputLine/Input" to="." method="send_command"]
|
[connection signal="text_entered" from="Control/InputLine/Input" to="." method="send_command"]
|
||||||
[connection signal="pressed" from="ClearButton" to="." method="clear"]
|
[connection signal="pressed" from="ClearButton" to="." method="clear"]
|
||||||
|
|
Loading…
Reference in a new issue