mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
Add a remote to the cardgame
This commit is contained in:
parent
fe711f9fc2
commit
d376c6a596
3 changed files with 28 additions and 11 deletions
|
@ -79,6 +79,9 @@ margin_right = 94.0
|
||||||
margin_bottom = -10.0
|
margin_bottom = -10.0
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
custom_styles/panel = SubResource( 3 )
|
custom_styles/panel = SubResource( 3 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Description" type="Label" parent="."]
|
[node name="Description" type="Label" parent="."]
|
||||||
margin_left = -92.0
|
margin_left = -92.0
|
||||||
|
|
22
cardgame.gd
22
cardgame.gd
|
@ -9,30 +9,36 @@ var cards = [
|
||||||
{"command": 'git merge', "arg_number": 1, "description": "Merge specified commit into HEAD."},
|
{"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 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 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():
|
func _ready():
|
||||||
|
|
||||||
var path = game.tmp_prefix_inside+"/repos/sandbox/"
|
var path = game.tmp_prefix_inside+"/repos/sandbox/"
|
||||||
helpers.careful_delete(path)
|
helpers.careful_delete(path)
|
||||||
|
|
||||||
game.global_shell.run("mkdir " + path)
|
game.global_shell.run("mkdir " + path)
|
||||||
game.global_shell.cd(path)
|
game.global_shell.cd(path)
|
||||||
game.global_shell.run("git init")
|
game.global_shell.run("git init")
|
||||||
game.global_shell.run("git symbolic-ref HEAD refs/heads/main")
|
game.global_shell.run("git remote add origin ../remote")
|
||||||
game.global_shell.run("git commit --allow-empty -m 'Initial commit'")
|
|
||||||
|
|
||||||
$Repository.path = path
|
$Repository.path = path
|
||||||
|
|
||||||
|
|
||||||
$Terminal.repository = $Repository
|
$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()
|
redraw_all_cards()
|
||||||
arrange_cards()
|
arrange_cards()
|
||||||
|
|
||||||
func _update_repo():
|
func _update_repo():
|
||||||
$Repository.update_everything()
|
$Repository.update_everything()
|
||||||
|
$RepositoryRemote.update_everything()
|
||||||
|
|
||||||
func draw_rand_card():
|
func draw_rand_card():
|
||||||
var new_card = preload("res://card.tscn").instance()
|
var new_card = preload("res://card.tscn").instance()
|
||||||
|
@ -51,7 +57,7 @@ func arrange_cards():
|
||||||
yield(t, "timeout")
|
yield(t, "timeout")
|
||||||
|
|
||||||
var amount_cards = get_tree().get_nodes_in_group("cards").size()
|
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
|
var angle_between_cards = 0
|
||||||
if amount_cards > 1:
|
if amount_cards > 1:
|
||||||
angle_between_cards = total_angle / (amount_cards-1)
|
angle_between_cards = total_angle / (amount_cards-1)
|
||||||
|
|
|
@ -18,9 +18,17 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_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 )]
|
[node name="Repository" parent="." instance=ExtResource( 3 )]
|
||||||
|
margin_left = 762.0
|
||||||
margin_right = 1481.0
|
margin_right = 1481.0
|
||||||
margin_bottom = 592.0
|
margin_bottom = 744.0
|
||||||
|
label = "yours"
|
||||||
simplified_view = true
|
simplified_view = true
|
||||||
|
|
||||||
[node name="DropArea" parent="." instance=ExtResource( 2 )]
|
[node name="DropArea" parent="." instance=ExtResource( 2 )]
|
||||||
|
@ -29,7 +37,7 @@ simplified_view = true
|
||||||
margin_left = 1488.0
|
margin_left = 1488.0
|
||||||
margin_top = 5.0
|
margin_top = 5.0
|
||||||
margin_right = 1914.0
|
margin_right = 1914.0
|
||||||
margin_bottom = 586.0
|
margin_bottom = 745.0
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="."]
|
[node name="Button" type="Button" parent="."]
|
||||||
margin_left = 1719.41
|
margin_left = 1719.41
|
||||||
|
@ -37,7 +45,7 @@ margin_top = 814.594
|
||||||
margin_right = 1892.41
|
margin_right = 1892.41
|
||||||
margin_bottom = 856.594
|
margin_bottom = 856.594
|
||||||
custom_fonts/font = ExtResource( 1 )
|
custom_fonts/font = ExtResource( 1 )
|
||||||
text = "redraw cards"
|
text = "Draw new cards"
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue