From 6eaa5e08e075edd67e70d059f76315f622b61e6e Mon Sep 17 00:00:00 2001 From: Anthony Wilcox <35226681+antonwilc0x@users.noreply.github.com> Date: Tue, 11 Jun 2019 01:17:42 -0400 Subject: [PATCH] Rewrote more code - Detatched LicenseWin node from PauseScn so it could be instanced by TitleScn and in other parts of the game. --- project/Nathan's Dress Up.csproj | 4 +++ project/scn/CreditsScn.tscn | 9 +---- project/scn/LicenseWin.tscn | 56 ++++++++++++++++++++++++++++++++ project/scn/PauseScn.tscn | 54 +----------------------------- project/scn/TitleScn.tscn | 53 ++---------------------------- project/src/CreditsScn.gd | 3 +- project/{ => src}/ImportItems.gd | 0 project/src/PauseScn.cs | 43 ++++++++++++++++++++++++ project/src/TitleScn.cs | 7 ++-- 9 files changed, 112 insertions(+), 117 deletions(-) create mode 100644 project/scn/LicenseWin.tscn rename project/{ => src}/ImportItems.gd (100%) create mode 100644 project/src/PauseScn.cs diff --git a/project/Nathan's Dress Up.csproj b/project/Nathan's Dress Up.csproj index 80ca6f1..dbee5f1 100644 --- a/project/Nathan's Dress Up.csproj +++ b/project/Nathan's Dress Up.csproj @@ -56,6 +56,7 @@ + @@ -68,5 +69,8 @@ + + + \ No newline at end of file diff --git a/project/scn/CreditsScn.tscn b/project/scn/CreditsScn.tscn index 051ca30..506f7cf 100644 --- a/project/scn/CreditsScn.tscn +++ b/project/scn/CreditsScn.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://styles/DressUpTheme.res" type="Theme" id=2] [ext_resource path="res://scn/Character.tscn" type="PackedScene" id=3] [ext_resource path="res://scn/PauseScn.tscn" type="PackedScene" id=4] -[ext_resource path="res://src/Soundtrack.gd" type="Script" id=5] +[ext_resource path="res://src/Soundtrack.cs" type="Script" id=5] [node name="Credits" type="Node"] script = ExtResource( 1 ) @@ -62,10 +62,3 @@ position = Vector2( 68.8273, 256.845 ) [node name="Music" type="AudioStreamPlayer" parent="."] script = ExtResource( 5 ) - -[node name="Version" type="Label" parent="."] -margin_left = 950.908 -margin_top = 568.64 -margin_right = 990.908 -margin_bottom = 582.64 -text = "Version" diff --git a/project/scn/LicenseWin.tscn b/project/scn/LicenseWin.tscn new file mode 100644 index 0000000..d69b711 --- /dev/null +++ b/project/scn/LicenseWin.tscn @@ -0,0 +1,56 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://styles/DressUpTheme.res" type="Theme" id=1] + +[node name="LicenseWin" type="AcceptDialog"] +editor/display_folded = true +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -202.0 +margin_top = -137.5 +margin_right = 202.0 +margin_bottom = 137.5 +theme = ExtResource( 1 ) +window_title = "KLIC" +resizable = true + +[node name="LicenseTxt" type="RichTextLabel" parent="."] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -194.0 +margin_top = 8.0 +margin_right = 194.0 +margin_bottom = 239.0 +bbcode_enabled = true +bbcode_text = "Nathan's Dress Up is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. + +Nathan's Dress Up is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with Nathan's Dress Up. If not, see: https://www.gnu.org/licenses/ + +[center]##########################[/center] + +Nathan's Dress Up (c) by Anthony Wilcox + +Nathan's Dress Up is licensed under a Creative Commons +Attribution-ShareAlike 4.0 International License. + +You should have received a copy of the license along with this work. +If not, see ." +text = "Nathan's Dress Up is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. + +Nathan's Dress Up is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with Nathan's Dress Up. If not, see: https://www.gnu.org/licenses/ + +########################## + +Nathan's Dress Up (c) by Anthony Wilcox + +Nathan's Dress Up is licensed under a Creative Commons +Attribution-ShareAlike 4.0 International License. + +You should have received a copy of the license along with this work. +If not, see ." diff --git a/project/scn/PauseScn.tscn b/project/scn/PauseScn.tscn index 3ff02da..5b14c48 100644 --- a/project/scn/PauseScn.tscn +++ b/project/scn/PauseScn.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=2] [ext_resource path="res://styles/DressUpTheme.res" type="Theme" id=1] -[ext_resource path="res://src/PauseScn.gd" type="Script" id=2] +[ext_resource path="res://src/PauseScn.cs" type="Script" id=2] [node name="WinDialogs" type="Control"] anchor_left = 0.5 @@ -148,58 +148,6 @@ margin_right = 65.0 margin_bottom = 24.0 text = "KMUS" align = 1 - -[node name="LicenseWin" type="AcceptDialog" parent="."] -editor/display_folded = true -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -202.0 -margin_top = -137.5 -margin_right = 202.0 -margin_bottom = 137.5 -window_title = "KLIC" -resizable = true - -[node name="LicenseTxt" type="RichTextLabel" parent="LicenseWin"] -anchor_left = 0.5 -anchor_right = 0.5 -margin_left = -194.0 -margin_top = 8.0 -margin_right = 194.0 -margin_bottom = 238.0 -bbcode_enabled = true -bbcode_text = "Nathan's Dress Up is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - -Nathan's Dress Up is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with Nathan's Dress Up. If not, see: https://www.gnu.org/licenses/ - -[center]##########################[/center] - -Nathan's Dress Up (c) by Anthony Wilcox - -Nathan's Dress Up is licensed under a Creative Commons -Attribution-ShareAlike 4.0 International License. - -You should have received a copy of the license along with this work. -If not, see ." -text = "Nathan's Dress Up is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - -Nathan's Dress Up is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with Nathan's Dress Up. If not, see: https://www.gnu.org/licenses/ - -########################## - -Nathan's Dress Up (c) by Anthony Wilcox - -Nathan's Dress Up is licensed under a Creative Commons -Attribution-ShareAlike 4.0 International License. - -You should have received a copy of the license along with this work. -If not, see ." [connection signal="pressed" from="PauseWin/PauseVbox/SettingsBtn" to="." method="_on_SettingsBtn_pressed"] [connection signal="pressed" from="PauseWin/PauseVbox/ResumeBtn" to="." method="_on_ResumeBtn_pressed"] [connection signal="pressed" from="PauseWin/PauseVbox/ExitBtn" to="." method="_on_ExitBtn_pressed"] diff --git a/project/scn/TitleScn.tscn b/project/scn/TitleScn.tscn index e631c3e..2a07373 100644 --- a/project/scn/TitleScn.tscn +++ b/project/scn/TitleScn.tscn @@ -3,7 +3,7 @@ [ext_resource path="res://src/TitleScn.cs" type="Script" id=1] [ext_resource path="res://styles/DressUpTheme.res" type="Theme" id=2] [ext_resource path="res://sprites/title.svg" type="Texture" id=3] -[ext_resource path="res://scn/PauseScn.tscn" type="PackedScene" id=4] +[ext_resource path="res://scn/LicenseWin.tscn" type="PackedScene" id=4] [node name="Start" type="Node"] script = ExtResource( 1 ) @@ -50,56 +50,7 @@ margin_right = 136.0 margin_bottom = 71.0 text = "KLIC" -[node name="ModePanel" type="WindowDialog" parent="MenuRf"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -73.0 -margin_top = -46.0 -margin_right = 73.0 -margin_bottom = 46.0 - -[node name="PlayVbox" type="VBoxContainer" parent="MenuRf/ModePanel"] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 5.0 -margin_top = 5.0 -margin_right = -5.0 -margin_bottom = -5.0 - -[node name="ModeLbl" type="Label" parent="MenuRf/ModePanel/PlayVbox"] -margin_right = 136.0 -margin_bottom = 14.0 -text = "KGMO" -align = 1 - -[node name="ModernBtn" type="Button" parent="MenuRf/ModePanel/PlayVbox"] -margin_top = 18.0 -margin_right = 136.0 -margin_bottom = 38.0 -text = "Modern" - -[node name="ClassicBtn" type="Button" parent="MenuRf/ModePanel/PlayVbox"] -margin_top = 42.0 -margin_right = 136.0 -margin_bottom = 62.0 -text = "KCLS" - -[node name="WinDialogs" parent="." instance=ExtResource( 4 )] -margin_left = 97.0 -margin_top = 37.0 -margin_right = 97.0 -margin_bottom = 37.0 - -[node name="Version" type="Label" parent="."] -margin_left = 950.908 -margin_top = 568.64 -margin_right = 990.908 -margin_bottom = 582.64 -text = "Version" +[node name="LicenseWin" parent="." instance=ExtResource( 4 )] [connection signal="pressed" from="MenuRf/StartVbox/PlayBtn" to="." method="_on_PlayBtn_pressed"] [connection signal="pressed" from="MenuRf/StartVbox/CreditsBtn" to="." method="_on_CreditsBtn_pressed"] [connection signal="pressed" from="MenuRf/StartVbox/LicenseBtn" to="." method="_on_LicenseBtn_pressed"] -[connection signal="pressed" from="MenuRf/ModePanel/PlayVbox/ModernBtn" to="." method="_on_ModernBtn_pressed"] -[connection signal="pressed" from="MenuRf/ModePanel/PlayVbox/ClassicBtn" to="." method="_on_ClassicBtn_pressed"] diff --git a/project/src/CreditsScn.gd b/project/src/CreditsScn.gd index ab90972..762845b 100644 --- a/project/src/CreditsScn.gd +++ b/project/src/CreditsScn.gd @@ -1,4 +1,5 @@ extends Node func _ready(): - $Version.text = GameKit.version \ No newline at end of file +# $Version.text = GameKit.version + pass \ No newline at end of file diff --git a/project/ImportItems.gd b/project/src/ImportItems.gd similarity index 100% rename from project/ImportItems.gd rename to project/src/ImportItems.gd diff --git a/project/src/PauseScn.cs b/project/src/PauseScn.cs new file mode 100644 index 0000000..4239061 --- /dev/null +++ b/project/src/PauseScn.cs @@ -0,0 +1,43 @@ +using Godot; + +public class PauseScn : Control +{ + void IsGamePaused(bool isPaused) + { + if (isPaused) + GetTree().Paused = true; + else + GetTree().Paused = false; + } + + public override void _Ready() + { + + } + + public override void _Process(float delta) + { + if (Input.IsActionPressed("ui_pause")) + { + GetNode("PauseWin").Show(); + IsGamePaused(true); + } + } + + void _on_ExitBtn_pressed() + { + IsGamePaused(false); + GetTree().ChangeScene("res://scn/TitleScn.tscn"); + } + + void _on_SettingsBtn_pressed() + { + GetNode("SettingsWin").Show(); + } + + void _on_ResumeBtn_pressed() + { + GetNode("PauseWin").Hide(); + IsGamePaused(false); + } +} diff --git a/project/src/TitleScn.cs b/project/src/TitleScn.cs index 08b767a..95677ea 100644 --- a/project/src/TitleScn.cs +++ b/project/src/TitleScn.cs @@ -11,9 +11,8 @@ public class TitleScn : Node { void _on_CreditsBtn_pressed() { GetTree().ChangeScene("res://scn/CreditsScn.tscn"); } - - void _on_LicenseBtn_pressed() { - var licenseWin = GetNode ("WinDialogs/LicenseWin"); - licenseWin.Show (); + void _on_LicenseBtn_pressed() + { + GetNode("LicenseWin").Show(); } } \ No newline at end of file