Add a remote to the cardgame

This commit is contained in:
Sebastian Morr 2020-10-14 00:46:41 +02:00
parent fe711f9fc2
commit d376c6a596
3 changed files with 28 additions and 11 deletions

View file

@ -79,6 +79,9 @@ margin_right = 94.0
margin_bottom = -10.0
mouse_filter = 2
custom_styles/panel = SubResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Description" type="Label" parent="."]
margin_left = -92.0

View file

@ -9,30 +9,36 @@ var cards = [
{"command": 'git merge', "arg_number": 1, "description": "Merge specified commit into HEAD."},
{"command": 'git update-ref -d', "arg_number": 1, "description": "Delete a ref."},
{"command": 'git reflog expire --expire=now --all; git prune', "arg_number": 0, "description": "Delete all unreferenced objects."},
{"command": 'git rebase', "arg_number": 1, "description": "Rebase current branch on top of specified commit."}
{"command": 'git rebase', "arg_number": 1, "description": "Rebase current branch on top of specified commit."},
{"command": 'git push -f', "arg_number": 0, "description": "Push current branch to the remote. Will make everyone angry."},
]
func _ready():
var path = game.tmp_prefix_inside+"/repos/sandbox/"
helpers.careful_delete(path)
game.global_shell.run("mkdir " + path)
game.global_shell.cd(path)
game.global_shell.run("git init")
game.global_shell.run("git symbolic-ref HEAD refs/heads/main")
game.global_shell.run("git commit --allow-empty -m 'Initial commit'")
game.global_shell.run("git remote add origin ../remote")
$Repository.path = path
$Terminal.repository = $Repository
var path2 = game.tmp_prefix_inside+"/repos/remote/"
helpers.careful_delete(path2)
game.global_shell.run("mkdir " + path2)
game.global_shell.cd(path2)
game.global_shell.run("git init")
game.global_shell.run("git config receive.denyCurrentBranch ignore")
$RepositoryRemote.path = path2
redraw_all_cards()
arrange_cards()
func _update_repo():
$Repository.update_everything()
$RepositoryRemote.update_everything()
func draw_rand_card():
var new_card = preload("res://card.tscn").instance()
@ -51,7 +57,7 @@ func arrange_cards():
yield(t, "timeout")
var amount_cards = get_tree().get_nodes_in_group("cards").size()
var total_angle = 45.0/7*amount_cards
var total_angle = min(50, 45.0/7*amount_cards)
var angle_between_cards = 0
if amount_cards > 1:
angle_between_cards = total_angle / (amount_cards-1)

View file

@ -18,9 +18,17 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="RepositoryRemote" parent="." instance=ExtResource( 3 )]
margin_right = 748.0
margin_bottom = 746.0
label = "remote"
simplified_view = true
[node name="Repository" parent="." instance=ExtResource( 3 )]
margin_left = 762.0
margin_right = 1481.0
margin_bottom = 592.0
margin_bottom = 744.0
label = "yours"
simplified_view = true
[node name="DropArea" parent="." instance=ExtResource( 2 )]
@ -29,7 +37,7 @@ simplified_view = true
margin_left = 1488.0
margin_top = 5.0
margin_right = 1914.0
margin_bottom = 586.0
margin_bottom = 745.0
[node name="Button" type="Button" parent="."]
margin_left = 1719.41
@ -37,7 +45,7 @@ margin_top = 814.594
margin_right = 1892.41
margin_bottom = 856.594
custom_fonts/font = ExtResource( 1 )
text = "redraw cards"
text = "Draw new cards"
__meta__ = {
"_edit_use_anchors_": false
}