Added draw game option for non hotseat games

This commit is contained in:
Sch1nken 2024-04-20 02:08:59 +02:00
parent 0385858d4f
commit 416c48891d
4 changed files with 241 additions and 74 deletions

233
Game.tscn
View file

@ -1,4 +1,4 @@
[gd_scene load_steps=28 format=3 uid="uid://bx0bbrwdr0h40"]
[gd_scene load_steps=30 format=3 uid="uid://bx0bbrwdr0h40"]
[ext_resource type="Script" path="res://Game.gd" id="1_dgt1j"]
[ext_resource type="Script" path="res://CameraPivot.gd" id="2_71xp1"]
@ -17,6 +17,7 @@
[ext_resource type="Script" path="res://addons/awesome_input_icons/classes/InputIconTextureRect.gd" id="13_mbmni"]
[ext_resource type="Texture2D" uid="uid://20wqrthwoqr0" path="res://addons/awesome_input_icons/assets/keyboard and mouse vector/mouse_move.svg" id="14_t8b21"]
[ext_resource type="Script" path="res://UI/ActionMoveMenu.gd" id="15_gc6p8"]
[ext_resource type="Script" path="res://DrawInfo.gd" id="16_enu5g"]
[ext_resource type="Script" path="res://UI/GameSettings.gd" id="16_uww8u"]
[sub_resource type="PlaneMesh" id="PlaneMesh_cu5ir"]
@ -59,6 +60,9 @@ texture = SubResource("GradientTexture2D_tjcjh")
axis_stretch_vertical = 2
modulate_color = Color(1, 1, 1, 0.639216)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_74vw4"]
bg_color = Color(0, 0, 0, 0.341176)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_51vcp"]
bg_color = Color(0.345098, 0.345098, 0.345098, 1)
@ -242,73 +246,6 @@ size_flags_horizontal = 4
size_flags_vertical = 0
mouse_filter = 2
[node name="MenuButtons" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
script = ExtResource("11_urihv")
[node name="VBoxContainer" type="VBoxContainer" parent="MenuButtons"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="MenuButton" type="Button" parent="MenuButtons/VBoxContainer"]
layout_mode = 2
text = "Menu"
[node name="PassRoundButton" type="Button" parent="MenuButtons/VBoxContainer"]
layout_mode = 2
text = "Pass"
[node name="SurrenderButton" type="Button" parent="MenuButtons/VBoxContainer"]
layout_mode = 2
text = "Surrender"
[node name="OfferDrawButton" type="Button" parent="MenuButtons/VBoxContainer"]
layout_mode = 2
disabled = true
text = "Offer Draw"
[node name="RulesButton" type="Button" parent="MenuButtons/VBoxContainer"]
layout_mode = 2
text = "Rules"
[node name="GameOverMenu" type="CanvasLayer" parent="."]
visible = false
script = ExtResource("11_ffmss")
[node name="Control" type="Control" parent="GameOverMenu"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="PanelContainer" type="PanelContainer" parent="GameOverMenu/Control"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="GameOverMenu/Control/PanelContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Label" type="Label" parent="GameOverMenu/Control/PanelContainer/VBoxContainer"]
layout_mode = 2
text = "#WINNER#"
horizontal_alignment = 1
[node name="Button" type="Button" parent="GameOverMenu/Control/PanelContainer/VBoxContainer"]
layout_mode = 2
text = "Back to menu"
[node name="InputInfo" type="Control" parent="."]
layout_mode = 3
anchors_preset = 1
@ -487,6 +424,162 @@ theme_override_font_sizes/font_size = 20
text = "Show/Hide controls"
horizontal_alignment = 2
[node name="MenuButtons" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
script = ExtResource("11_urihv")
[node name="VBoxContainer" type="VBoxContainer" parent="MenuButtons"]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="MenuButton" type="Button" parent="MenuButtons/VBoxContainer"]
layout_mode = 2
text = "Menu"
[node name="PassRoundButton" type="Button" parent="MenuButtons/VBoxContainer"]
layout_mode = 2
text = "Pass"
[node name="SurrenderButton" type="Button" parent="MenuButtons/VBoxContainer"]
layout_mode = 2
text = "Surrender"
[node name="OfferDrawButton" type="Button" parent="MenuButtons/VBoxContainer"]
layout_mode = 2
text = "Offer Draw"
[node name="RulesButton" type="Button" parent="MenuButtons/VBoxContainer"]
layout_mode = 2
text = "Rules"
[node name="DrawInfo" type="Control" parent="."]
visible = false
layout_mode = 3
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("16_enu5g")
[node name="PanelContainer2" type="PanelContainer" parent="DrawInfo"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -620.0
offset_top = -340.0
offset_right = 620.0
offset_bottom = 340.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_74vw4")
[node name="PanelContainer" type="PanelContainer" parent="DrawInfo"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="DrawInfo/PanelContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_constants/margin_left = 15
theme_override_constants/margin_top = 15
theme_override_constants/margin_right = 15
theme_override_constants/margin_bottom = 15
[node name="OfferReceived" type="VBoxContainer" parent="DrawInfo/PanelContainer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Label" type="Label" parent="DrawInfo/PanelContainer/MarginContainer/OfferReceived"]
layout_mode = 2
text = "Your opponent wants to
call the game a draw.
Accept?
"
[node name="HBoxContainer" type="HBoxContainer" parent="DrawInfo/PanelContainer/MarginContainer/OfferReceived"]
layout_mode = 2
[node name="YesButton" type="Button" parent="DrawInfo/PanelContainer/MarginContainer/OfferReceived/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "YES"
[node name="NoButton" type="Button" parent="DrawInfo/PanelContainer/MarginContainer/OfferReceived/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "NO"
[node name="OfferSent" type="VBoxContainer" parent="DrawInfo/PanelContainer/MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="DrawInfo/PanelContainer/MarginContainer/OfferSent"]
layout_mode = 2
text = "Draw offer sent.
Waiting for opponents decision..."
[node name="GameOverMenu" type="CanvasLayer" parent="."]
visible = false
script = ExtResource("11_ffmss")
[node name="Control" type="Control" parent="GameOverMenu"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="PanelContainer" type="PanelContainer" parent="GameOverMenu/Control"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="GameOverMenu/Control/PanelContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Label" type="Label" parent="GameOverMenu/Control/PanelContainer/VBoxContainer"]
layout_mode = 2
text = "#WINNER#"
horizontal_alignment = 1
[node name="Button" type="Button" parent="GameOverMenu/Control/PanelContainer/VBoxContainer"]
layout_mode = 2
text = "Back to menu"
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="ActionMoveMenu" type="Control" parent="CanvasLayer"]
@ -625,8 +718,10 @@ text = "Start"
[connection signal="pressed" from="MenuButtons/VBoxContainer/MenuButton" to="MenuButtons" method="_on_menu_button_pressed"]
[connection signal="pressed" from="MenuButtons/VBoxContainer/PassRoundButton" to="MenuButtons" method="_on_pass_round_button_pressed"]
[connection signal="pressed" from="MenuButtons/VBoxContainer/SurrenderButton" to="MenuButtons" method="_on_surrender_button_pressed"]
[connection signal="pressed" from="MenuButtons/VBoxContainer/OfferDrawButton" to="MenuButtons" method="_on_menu_button_pressed"]
[connection signal="pressed" from="MenuButtons/VBoxContainer/OfferDrawButton" to="MenuButtons" method="_on_offer_draw_button_pressed"]
[connection signal="pressed" from="MenuButtons/VBoxContainer/RulesButton" to="MenuButtons" method="_on_rules_button_pressed"]
[connection signal="pressed" from="DrawInfo/PanelContainer/MarginContainer/OfferReceived/HBoxContainer/YesButton" to="DrawInfo" method="_on_yes_button_pressed"]
[connection signal="pressed" from="DrawInfo/PanelContainer/MarginContainer/OfferReceived/HBoxContainer/NoButton" to="DrawInfo" method="_on_no_button_pressed"]
[connection signal="pressed" from="GameOverMenu/Control/PanelContainer/VBoxContainer/Button" to="GameOverMenu" method="_on_button_pressed"]
[connection signal="pressed" from="CanvasLayer/ActionMoveMenu/PanelContainer/MarginContainer/VBoxContainer/MoveButton" to="CanvasLayer/ActionMoveMenu" method="_on_move_button_pressed"]
[connection signal="pressed" from="CanvasLayer/ActionMoveMenu/PanelContainer/MarginContainer/VBoxContainer/ActionButton" to="CanvasLayer/ActionMoveMenu" method="_on_action_button_pressed"]