mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-13 19:04:54 +01:00
Remove comments and unused files
This commit is contained in:
parent
06063d5ee6
commit
c330524f8e
15 changed files with 33 additions and 152 deletions
10
arrow.gd
10
arrow.gd
|
@ -1,7 +1,5 @@
|
|||
extends Node2D
|
||||
|
||||
var label = "label" setget label_set
|
||||
|
||||
var source: String
|
||||
var target: String
|
||||
|
||||
|
@ -11,7 +9,6 @@ func _ready():
|
|||
pass
|
||||
|
||||
func _process(_delta):
|
||||
#position = -repository.objects[source].position
|
||||
position = Vector2(0,0)
|
||||
|
||||
if not (repository and repository.objects.has(source)):
|
||||
|
@ -27,7 +24,7 @@ func _process(_delta):
|
|||
else:
|
||||
$Target.text = target
|
||||
if $Target.text.substr(0, 5) != "refs/":
|
||||
$Target.text = ""#$Target.text.substr(0,8)
|
||||
$Target.text = ""
|
||||
$Target.show()
|
||||
$Line.hide()
|
||||
$Tip.hide()
|
||||
|
@ -35,10 +32,5 @@ func _process(_delta):
|
|||
$Line.points[1] = end - repository.objects[source].position
|
||||
# Move the tip away from the object a bit.
|
||||
$Line.points[1] -= $Line.points[1].normalized()*30
|
||||
#$Label.position = ($Line.points[0] + $Line.points[1])/1.3
|
||||
$Tip.position = $Line.points[1]
|
||||
$Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1])
|
||||
|
||||
func label_set(new_label):
|
||||
label = new_label
|
||||
$Label/ID.text = label
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
extends Button
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
func pressed():
|
||||
$"../../..".send_command(text)
|
13
card.gd
13
card.gd
|
@ -35,19 +35,9 @@ func _process(delta):
|
|||
if hovered and not dragged:
|
||||
target_scale = 1.5
|
||||
|
||||
# if hovered:
|
||||
# rotation = 0
|
||||
# else:
|
||||
# if _home_rotation:
|
||||
# rotation_degrees = _home_rotation
|
||||
|
||||
var speed = 5
|
||||
|
||||
scale = lerp(scale, Vector2(target_scale, target_scale), 10*delta)
|
||||
# if scale.x < target_scale:
|
||||
# scale += speed*delta*Vector2(1, 1)
|
||||
# elif scale.x > target_scale:
|
||||
# scale -= speed*delta*Vector2(1, 1)
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseButton:
|
||||
|
@ -99,9 +89,6 @@ func move_back():
|
|||
|
||||
func buuurn():
|
||||
move_back()
|
||||
#queue_free()
|
||||
#$"..".draw_rand_card()
|
||||
#$"..".arrange_cards()
|
||||
|
||||
func dropped_on(other):
|
||||
var full_command = ""
|
||||
|
|
|
@ -217,8 +217,6 @@ func redraw_all_cards():
|
|||
for card in get_tree().get_nodes_in_group("cards"):
|
||||
card.queue_free()
|
||||
|
||||
# for i in range(7):
|
||||
# draw_rand_card()
|
||||
for card in cards:
|
||||
draw_card(card)
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://drop_area.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://repository.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://cardgame.gd" type="Script" id=4]
|
||||
[ext_resource path="res://terminal.tscn" type="PackedScene" id=5]
|
||||
|
@ -32,8 +31,6 @@ margin_bottom = 744.0
|
|||
label = "yours"
|
||||
simplified_view = true
|
||||
|
||||
[node name="DropArea" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Terminal" parent="." instance=ExtResource( 5 )]
|
||||
margin_left = 1488.0
|
||||
margin_top = 5.0
|
||||
|
|
6
main.gd
6
main.gd
|
@ -64,12 +64,6 @@ func load_level(level_id):
|
|||
level_congrats.bbcode_text = level.congrats
|
||||
level_name.text = level.title
|
||||
|
||||
# var code_regex = RegEx.new()
|
||||
# code_regex.compile("\\[code\\]([^\\[]*)\\[/code\\]")
|
||||
# var matches = code_regex.search_all(level.description)
|
||||
# for m in matches:
|
||||
# cards.add_card(m.get_string(1))
|
||||
|
||||
for r in repositories_node.get_children():
|
||||
r.queue_free()
|
||||
repositories = {}
|
||||
|
|
21
main.tscn
21
main.tscn
|
@ -1,14 +1,12 @@
|
|||
[gd_scene load_steps=11 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://terminal.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://main.gd" type="Script" id=2]
|
||||
[ext_resource path="res://cards.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://styles/alert_button.tres" type="StyleBox" id=4]
|
||||
[ext_resource path="res://tcp_server.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://styles/theme.tres" type="Theme" id=6]
|
||||
[ext_resource path="res://fonts/big.tres" type="DynamicFont" id=7]
|
||||
[ext_resource path="res://sounds/success.wav" type="AudioStream" id=8]
|
||||
[ext_resource path="res://test.gd" type="Script" id=9]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
content_margin_left = 10.0
|
||||
|
@ -204,22 +202,6 @@ margin_bottom = 1064.0
|
|||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 0.35
|
||||
|
||||
[node name="Test" type="Node2D" parent="."]
|
||||
visible = false
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="TCPServer" parent="Test" instance=ExtResource( 5 )]
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="Test"]
|
||||
margin_left = 720.526
|
||||
margin_top = 691.052
|
||||
margin_right = 1130.53
|
||||
margin_bottom = 778.052
|
||||
caret_blink = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SuccessSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 8 )
|
||||
[connection signal="button_down" from="Rows/Columns/RightSide/TopStuff/Menu/ChapterSelect" to="." method="repopulate_chapters"]
|
||||
|
@ -228,4 +210,3 @@ stream = ExtResource( 8 )
|
|||
[connection signal="pressed" from="Rows/Columns/RightSide/TopStuff/Menu/CardsButton" to="." method="toggle_cards"]
|
||||
[connection signal="pressed" from="Rows/Columns/RightSide/TopStuff/Menu/NextLevelButton" to="." method="load_next_level"]
|
||||
[connection signal="command_done" from="Rows/Columns/RightSide/Terminal" to="." method="update_repos"]
|
||||
[connection signal="text_entered" from="Test/LineEdit" to="Test" method="send"]
|
||||
|
|
9
node.gd
9
node.gd
|
@ -60,28 +60,20 @@ func type_set(new_type):
|
|||
file_browser.title = "Commit"
|
||||
if type != "ref":
|
||||
$ID.text = $ID.text.substr(0,8)
|
||||
#elif type == "ref":
|
||||
#$ID.text = $ID.text.replace("refs/", "")
|
||||
match new_type:
|
||||
"blob":
|
||||
$Sprite.texture = preload("res://nodes/blob.svg")
|
||||
#$Rect.color = Color("#333333")
|
||||
"tree":
|
||||
$Sprite.texture = preload("res://nodes/tree.svg")
|
||||
#$Rect.color = Color.darkgreen
|
||||
"commit":
|
||||
$Sprite.texture = preload("res://nodes/commit.svg")
|
||||
#$Rect.color = Color.orange
|
||||
"tag":
|
||||
$Sprite.texture = preload("res://nodes/blob.svg")
|
||||
#$Rect.color = Color.blue
|
||||
"ref":
|
||||
$Sprite.texture = preload("res://nodes/ref.svg")
|
||||
#$Rect.color = Color("#6680ff")
|
||||
id_always_visible = true
|
||||
"head":
|
||||
$Sprite.texture = preload("res://nodes/ref.svg")
|
||||
#$Rect.color = Color.red
|
||||
id_always_visible = true
|
||||
if id_always_visible:
|
||||
$ID.show()
|
||||
|
@ -93,7 +85,6 @@ func children_set(new_children):
|
|||
for c in new_children:
|
||||
if not children.has(c):
|
||||
var a = arrow.instance()
|
||||
a.label = new_children[c]
|
||||
a.source = id
|
||||
a.target = c
|
||||
a.repository = repository
|
||||
|
|
11
player.gd
11
player.gd
|
@ -1,11 +0,0 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
export var speed = 800
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
var right = Input.get_action_strength("right") - Input.get_action_strength("left")
|
||||
var down = Input.get_action_strength("down") - Input.get_action_strength("up")
|
||||
move_and_slide(Vector2(right, down).normalized()*speed)
|
20
player.tscn
20
player.tscn
|
@ -1,15 +1,27 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://player.gd" type="Script" id=1]
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends KinematicBody2D
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
export var speed = 800
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
var right = Input.get_action_strength(\"right\") - Input.get_action_strength(\"left\")
|
||||
var down = Input.get_action_strength(\"down\") - Input.get_action_strength(\"up\")
|
||||
move_and_slide(Vector2(right, down).normalized()*speed)
|
||||
"
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 50, 50 )
|
||||
|
||||
[node name="Player" type="KinematicBody2D"]
|
||||
script = ExtResource( 1 )
|
||||
script = SubResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Rect" type="ColorRect" parent="."]
|
||||
margin_left = -50.0
|
||||
|
|
|
@ -342,5 +342,3 @@ func set_file_browser_active(active):
|
|||
file_browser_active = active
|
||||
if file_browser:
|
||||
file_browser.visible = active
|
||||
|
||||
|
||||
|
|
2
shell.gd
2
shell.gd
|
@ -6,8 +6,6 @@ var exit_code
|
|||
var _cwd
|
||||
var _os = OS.get_name()
|
||||
|
||||
#signal output(text)
|
||||
|
||||
func _init():
|
||||
_cwd = game.tmp_prefix_inside
|
||||
|
||||
|
|
36
terminal.gd
36
terminal.gd
|
@ -12,9 +12,7 @@ var git_commands_help = []
|
|||
onready var input = $Rows/InputLine/Input
|
||||
onready var output = $Rows/TopHalf/Output
|
||||
onready var completions = $Rows/TopHalf/Completions
|
||||
#export(NodePath) var repository_path
|
||||
var repository
|
||||
onready var command_dropdown = $Rows/InputLine/CommandDropdown
|
||||
onready var main = get_tree().get_root().get_node("Main")
|
||||
|
||||
var premade_commands = [
|
||||
|
@ -24,29 +22,11 @@ var premade_commands = [
|
|||
]
|
||||
|
||||
func _ready():
|
||||
#repository.shell.connect("output", self, "receive_output")
|
||||
|
||||
for command in premade_commands:
|
||||
command_dropdown.get_popup().add_item(command)
|
||||
command_dropdown.get_popup().connect("id_pressed", self, "load_command")
|
||||
|
||||
var error = $TextEditor.connect("hide", self, "editor_closed")
|
||||
if error != OK:
|
||||
helpers.crash("Could not connect TextEditor's hide signal")
|
||||
input.grab_focus()
|
||||
|
||||
# var all_git_commands = game.global_shell.run("git help -a | grep \"^ \\+[a-z-]\\+ \" -o")
|
||||
# git_commands = Array(all_git_commands.split("\n"))
|
||||
# for i in range(git_commands.size()):
|
||||
# git_commands[i] = git_commands[i].strip_edges(true, true)
|
||||
# git_commands.pop_back()
|
||||
|
||||
# var all_git_commands_help = game.global_shell.run("git help -a | grep \" [A-Z].\\+$\" -o")
|
||||
# git_commands_help = Array(all_git_commands_help.split("\n"))
|
||||
# for i in range(git_commands_help.size()):
|
||||
# git_commands_help[i] = git_commands_help[i].strip_edges(true, true)
|
||||
# git_commands_help.pop_back()
|
||||
|
||||
for subcommand in git_commands:
|
||||
git_commands_help.push_back("")
|
||||
|
||||
|
@ -84,16 +64,6 @@ func _input(event):
|
|||
else:
|
||||
input.text = "" + second_half
|
||||
|
||||
# Not currently used. :)
|
||||
func description_for_subcommand(subcommand):
|
||||
var manpage = game.global_shell.run("git help %s || true" % subcommand)
|
||||
var description_regex = RegEx.new()
|
||||
description_regex.compile("NAME\\n\\s+[^ ]+ - (.*)\\n")
|
||||
var regex_match = description_regex.search(manpage)
|
||||
if regex_match == null:
|
||||
return "(No description available.)"
|
||||
return regex_match.get_string(1)
|
||||
|
||||
func load_command(id):
|
||||
input.text = premade_commands[id]
|
||||
input.caret_position = input.text.length()
|
||||
|
@ -112,9 +82,7 @@ func send_command(command):
|
|||
thread.start(self, "run_command_in_a_thread", command)
|
||||
|
||||
func send_command_async(command):
|
||||
#output.text += "$ "+command+"\n"
|
||||
input.text = ""
|
||||
#repository.shell.run_async(command)
|
||||
$TCPServer.send(command+"\n")
|
||||
|
||||
func run_command_in_a_thread(command):
|
||||
|
@ -136,7 +104,6 @@ func run_command_in_a_thread(command):
|
|||
$Pager.popup()
|
||||
|
||||
emit_signal("command_done")
|
||||
#repository.update_everything()
|
||||
|
||||
func receive_output(text):
|
||||
output.text += text
|
||||
|
@ -176,9 +143,6 @@ func regenerate_completions_menu(new_text):
|
|||
|
||||
completions.margin_top = -min(filtered_comp.size() * 35 + 10, 210)
|
||||
|
||||
|
||||
|
||||
|
||||
func relevant_subcommands():
|
||||
var result = {}
|
||||
for h in game.state["history"]:
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
[ext_resource path="res://tcp_server.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://fonts/monospace.tres" type="DynamicFont" id=4]
|
||||
[ext_resource path="res://text_editor.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://button.gd" type="Script" id=6]
|
||||
[ext_resource path="res://sounds/buzzer.wav" type="AudioStream" id=7]
|
||||
[ext_resource path="res://sounds/typewriter_ding.wav" type="AudioStream" id=8]
|
||||
|
||||
|
@ -21,6 +20,16 @@ corner_radius_top_right = 10
|
|||
corner_radius_bottom_right = 10
|
||||
corner_radius_bottom_left = 10
|
||||
|
||||
[sub_resource type="GDScript" id=2]
|
||||
script/source = "extends Button
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
func pressed():
|
||||
$\"../../..\".send_command(text)
|
||||
"
|
||||
|
||||
[node name="Terminal" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
@ -76,21 +85,21 @@ margin_bottom = 1052.0
|
|||
margin_right = 1920.0
|
||||
margin_bottom = 20.0
|
||||
text = "git commit --allow-empty -m \"$RANDOM\""
|
||||
script = ExtResource( 6 )
|
||||
script = SubResource( 2 )
|
||||
|
||||
[node name="Button2" type="Button" parent="Rows/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 1920.0
|
||||
margin_bottom = 44.0
|
||||
text = "git checkout HEAD^"
|
||||
script = ExtResource( 6 )
|
||||
script = SubResource( 2 )
|
||||
|
||||
[node name="Button3" type="Button" parent="Rows/VBoxContainer"]
|
||||
margin_top = 48.0
|
||||
margin_right = 1920.0
|
||||
margin_bottom = 68.0
|
||||
text = "git checkout -b \"$RANDOM\""
|
||||
script = ExtResource( 6 )
|
||||
script = SubResource( 2 )
|
||||
|
||||
[node name="InputLine" type="HBoxContainer" parent="Rows"]
|
||||
margin_top = 1056.0
|
||||
|
@ -106,16 +115,6 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="CommandDropdown" type="MenuButton" parent="Rows/InputLine"]
|
||||
visible = false
|
||||
margin_left = 1896.0
|
||||
margin_right = 1920.0
|
||||
margin_bottom = 31.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "..."
|
||||
flat = false
|
||||
align = 0
|
||||
|
||||
[node name="ClearButton" type="Button" parent="."]
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
|
|
12
test.gd
12
test.gd
|
@ -1,12 +0,0 @@
|
|||
extends Node
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
func data(s):
|
||||
print(s)
|
||||
|
||||
|
||||
func send(new_text):
|
||||
print("sending "+new_text)
|
||||
$TCPServer.send(new_text)
|
Loading…
Reference in a new issue