From ad5d5836d6c0cabeab0db0a3391f70e5ce374a25 Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Wed, 14 Oct 2020 00:57:30 +0200 Subject: [PATCH] Add cards to the main scene --- card.gd | 18 +++++++++--------- cardgame.gd | 42 +++++++++++++++++++++--------------------- cards.tscn | 19 +++++++++++++++++++ main.tscn | 20 ++++++++++++-------- project.godot | 2 +- 5 files changed, 62 insertions(+), 39 deletions(-) create mode 100644 cards.tscn diff --git a/card.gd b/card.gd index 233b288..366af87 100644 --- a/card.gd +++ b/card.gd @@ -36,7 +36,7 @@ func _unhandled_input(event): if get_viewport().get_mouse_position().y < get_viewport().size.y/2: if arg_number == 0 : - $"../Terminal".send_command($Label.text) + $"../..".terminal.send_command($Label.text) buuurn() else: 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"): argument = Array(other.id.split("/")).pop_back() full_command = $Label.text + " " + argument - $"../Terminal".send_command(full_command) + $"../..".terminal.send_command(full_command) buuurn() - 2: - if _first_argument: - full_command = $Label.text + " " + _first_argument + " " + other.id - $"../Terminal".send_command(full_command) - buuurn() - else: - _first_argument = other.id +# 2: +# if _first_argument: +# full_command = $Label.text + " " + _first_argument + " " + other.id +# $"../Terminal".send_command(full_command) +# buuurn() +# else: +# _first_argument = other.id diff --git a/cardgame.gd b/cardgame.gd index 70b5448..ad5ed54 100644 --- a/cardgame.gd +++ b/cardgame.gd @@ -14,31 +14,31 @@ var cards = [ ] 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 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 +# 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 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 _update_repo(): +# $Repository.update_everything() +# $RepositoryRemote.update_everything() func draw_rand_card(): var new_card = preload("res://card.tscn").instance() diff --git a/cards.tscn b/cards.tscn new file mode 100644 index 0000000..897ce6c --- /dev/null +++ b/cards.tscn @@ -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"] diff --git a/main.tscn b/main.tscn index d39bb03..31d2c8e 100644 --- a/main.tscn +++ b/main.tscn @@ -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://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] @@ -22,6 +23,7 @@ corner_radius_bottom_left = 3 [node name="Main" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +margin_bottom = -285.0 mouse_filter = 2 theme = ExtResource( 6 ) script = ExtResource( 2 ) @@ -55,7 +57,7 @@ __meta__ = { [node name="Repositories" type="HBoxContainer" parent="Columns"] margin_right = 1267.0 -margin_bottom = 1070.0 +margin_bottom = 785.0 mouse_filter = 2 size_flags_horizontal = 3 size_flags_stretch_ratio = 2.0 @@ -67,12 +69,12 @@ __meta__ = { [node name="RightSide" type="VSplitContainer" parent="Columns"] margin_left = 1279.0 margin_right = 1910.0 -margin_bottom = 1070.0 +margin_bottom = 785.0 size_flags_horizontal = 3 [node name="TopStuff" type="VBoxContainer" parent="Columns/RightSide"] margin_right = 631.0 -margin_bottom = 529.0 +margin_bottom = 386.0 size_flags_vertical = 3 [node name="Menu" type="HBoxContainer" parent="Columns/RightSide/TopStuff"] @@ -122,7 +124,7 @@ __meta__ = { [node name="LevelPanel" type="VBoxContainer" parent="Columns/RightSide/TopStuff"] margin_top = 40.0 margin_right = 631.0 -margin_bottom = 529.0 +margin_bottom = 386.0 size_flags_vertical = 3 [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"] margin_top = 65.0 margin_right = 631.0 -margin_bottom = 489.0 +margin_bottom = 346.0 size_flags_vertical = 3 [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 )] anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 541.0 +margin_top = 398.0 margin_right = 631.0 -margin_bottom = 1070.0 +margin_bottom = 785.0 size_flags_vertical = 3 [node name="Test" type="Node2D" parent="."] @@ -187,6 +189,8 @@ caret_blink = true __meta__ = { "_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/LevelSelect" to="." method="repopulate_levels"] [connection signal="pressed" from="Columns/RightSide/TopStuff/Menu/ReloadButton" to="." method="reload_level"] diff --git a/project.godot b/project.godot index 022bc17..2430475 100644 --- a/project.godot +++ b/project.godot @@ -39,7 +39,7 @@ _global_script_class_icons={ [application] config/name="git-hydra" -run/main_scene="res://cardgame.tscn" +run/main_scene="res://main.tscn" config/use_custom_user_dir=true [autoload]