Add cards to the main scene

This commit is contained in:
Sebastian Morr 2020-10-14 00:57:30 +02:00
parent d376c6a596
commit ad5d5836d6
5 changed files with 62 additions and 39 deletions

18
card.gd
View file

@ -36,7 +36,7 @@ func _unhandled_input(event):
if get_viewport().get_mouse_position().y < get_viewport().size.y/2: if get_viewport().get_mouse_position().y < get_viewport().size.y/2:
if arg_number == 0 : if arg_number == 0 :
$"../Terminal".send_command($Label.text) $"../..".terminal.send_command($Label.text)
buuurn() buuurn()
else: else:
move_back() move_back()
@ -73,15 +73,15 @@ func dropped_on(other):
if ($Label.text.begins_with("git checkout") or $Label.text.begins_with("git rebase")) and other.id.begins_with("refs/heads"): if ($Label.text.begins_with("git checkout") or $Label.text.begins_with("git rebase")) and other.id.begins_with("refs/heads"):
argument = Array(other.id.split("/")).pop_back() argument = Array(other.id.split("/")).pop_back()
full_command = $Label.text + " " + argument full_command = $Label.text + " " + argument
$"../Terminal".send_command(full_command) $"../..".terminal.send_command(full_command)
buuurn() buuurn()
2: # 2:
if _first_argument: # if _first_argument:
full_command = $Label.text + " " + _first_argument + " " + other.id # full_command = $Label.text + " " + _first_argument + " " + other.id
$"../Terminal".send_command(full_command) # $"../Terminal".send_command(full_command)
buuurn() # buuurn()
else: # else:
_first_argument = other.id # _first_argument = other.id

View file

@ -14,31 +14,31 @@ var cards = [
] ]
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 remote add origin ../remote") # game.global_shell.run("git remote add origin ../remote")
$Repository.path = path # $Repository.path = path
$Terminal.repository = $Repository # $Terminal.repository = $Repository
#
var path2 = game.tmp_prefix_inside+"/repos/remote/" # var path2 = game.tmp_prefix_inside+"/repos/remote/"
helpers.careful_delete(path2) # helpers.careful_delete(path2)
#
game.global_shell.run("mkdir " + path2) # game.global_shell.run("mkdir " + path2)
game.global_shell.cd(path2) # game.global_shell.cd(path2)
game.global_shell.run("git init") # game.global_shell.run("git init")
game.global_shell.run("git config receive.denyCurrentBranch ignore") # game.global_shell.run("git config receive.denyCurrentBranch ignore")
$RepositoryRemote.path = path2 # $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() # $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()

19
cards.tscn Normal file
View file

@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=1]
[ext_resource path="res://cardgame.gd" type="Script" id=3]
[node name="Cards" type="Node2D"]
script = ExtResource( 3 )
[node name="Button" type="Button" parent="."]
margin_left = 1719.41
margin_top = 814.594
margin_right = 1892.41
margin_bottom = 856.594
custom_fonts/font = ExtResource( 1 )
text = "Draw new cards"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Button" to="." method="redraw_all_cards"]

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=9 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://cards.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://tcp_server.tscn" type="PackedScene" id=5] [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://styles/theme.tres" type="Theme" id=6]
@ -22,6 +23,7 @@ corner_radius_bottom_left = 3
[node name="Main" type="Control"] [node name="Main" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_bottom = -285.0
mouse_filter = 2 mouse_filter = 2
theme = ExtResource( 6 ) theme = ExtResource( 6 )
script = ExtResource( 2 ) script = ExtResource( 2 )
@ -55,7 +57,7 @@ __meta__ = {
[node name="Repositories" type="HBoxContainer" parent="Columns"] [node name="Repositories" type="HBoxContainer" parent="Columns"]
margin_right = 1267.0 margin_right = 1267.0
margin_bottom = 1070.0 margin_bottom = 785.0
mouse_filter = 2 mouse_filter = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_stretch_ratio = 2.0 size_flags_stretch_ratio = 2.0
@ -67,12 +69,12 @@ __meta__ = {
[node name="RightSide" type="VSplitContainer" parent="Columns"] [node name="RightSide" type="VSplitContainer" parent="Columns"]
margin_left = 1279.0 margin_left = 1279.0
margin_right = 1910.0 margin_right = 1910.0
margin_bottom = 1070.0 margin_bottom = 785.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="TopStuff" type="VBoxContainer" parent="Columns/RightSide"] [node name="TopStuff" type="VBoxContainer" parent="Columns/RightSide"]
margin_right = 631.0 margin_right = 631.0
margin_bottom = 529.0 margin_bottom = 386.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="Menu" type="HBoxContainer" parent="Columns/RightSide/TopStuff"] [node name="Menu" type="HBoxContainer" parent="Columns/RightSide/TopStuff"]
@ -122,7 +124,7 @@ __meta__ = {
[node name="LevelPanel" type="VBoxContainer" parent="Columns/RightSide/TopStuff"] [node name="LevelPanel" type="VBoxContainer" parent="Columns/RightSide/TopStuff"]
margin_top = 40.0 margin_top = 40.0
margin_right = 631.0 margin_right = 631.0
margin_bottom = 529.0 margin_bottom = 386.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="LevelName" type="RichTextLabel" parent="Columns/RightSide/TopStuff/LevelPanel"] [node name="LevelName" type="RichTextLabel" parent="Columns/RightSide/TopStuff/LevelPanel"]
@ -138,7 +140,7 @@ __meta__ = {
[node name="Text" type="Control" parent="Columns/RightSide/TopStuff/LevelPanel"] [node name="Text" type="Control" parent="Columns/RightSide/TopStuff/LevelPanel"]
margin_top = 65.0 margin_top = 65.0
margin_right = 631.0 margin_right = 631.0
margin_bottom = 489.0 margin_bottom = 346.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="LevelDescription" type="RichTextLabel" parent="Columns/RightSide/TopStuff/LevelPanel/Text"] [node name="LevelDescription" type="RichTextLabel" parent="Columns/RightSide/TopStuff/LevelPanel/Text"]
@ -167,9 +169,9 @@ __meta__ = {
[node name="Terminal" parent="Columns/RightSide" instance=ExtResource( 1 )] [node name="Terminal" parent="Columns/RightSide" instance=ExtResource( 1 )]
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_top = 541.0 margin_top = 398.0
margin_right = 631.0 margin_right = 631.0
margin_bottom = 1070.0 margin_bottom = 785.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="Test" type="Node2D" parent="."] [node name="Test" type="Node2D" parent="."]
@ -187,6 +189,8 @@ caret_blink = true
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Cards" parent="." instance=ExtResource( 3 )]
[connection signal="button_down" from="Columns/RightSide/TopStuff/Menu/ChapterSelect" to="." method="repopulate_chapters"] [connection signal="button_down" from="Columns/RightSide/TopStuff/Menu/ChapterSelect" to="." method="repopulate_chapters"]
[connection signal="button_down" from="Columns/RightSide/TopStuff/Menu/LevelSelect" to="." method="repopulate_levels"] [connection signal="button_down" from="Columns/RightSide/TopStuff/Menu/LevelSelect" to="." method="repopulate_levels"]
[connection signal="pressed" from="Columns/RightSide/TopStuff/Menu/ReloadButton" to="." method="reload_level"] [connection signal="pressed" from="Columns/RightSide/TopStuff/Menu/ReloadButton" to="." method="reload_level"]

View file

@ -39,7 +39,7 @@ _global_script_class_icons={
[application] [application]
config/name="git-hydra" config/name="git-hydra"
run/main_scene="res://cardgame.tscn" run/main_scene="res://main.tscn"
config/use_custom_user_dir=true config/use_custom_user_dir=true
[autoload] [autoload]