diff --git a/Phase2/Godot ===(Game Code)===/CharacterCreation/CharacterMenu.gd b/Phase2/Godot ===(Game Code)===/CharacterCreation/CharacterMenu.gd deleted file mode 100644 index d31ff7b..0000000 --- a/Phase2/Godot ===(Game Code)===/CharacterCreation/CharacterMenu.gd +++ /dev/null @@ -1,56 +0,0 @@ -extends Node2D - -var Gender = -1 -var Name = "" -var Profession = "" - -func _ready(): - add_items() - -func _process(delta): - match GameGlobal.PlayerSelect: - 0: - $PlayerSelect.play("Player0") - 1: - $PlayerSelect.play("Player1") - 2: - $PlayerSelect.play("Player2") - 3: - $PlayerSelect.play("Player3") - 4: - $PlayerSelect.play("Player4") - 5: - $PlayerSelect.play("Player5") - - if (Gender != -1 and Name and Profession): - $Play.disabled = false - -func _on_Right_pressed(): - if GameGlobal.PlayerSelect < 5: - GameGlobal.PlayerSelect += 1 - -func _on_Left_pressed(): - if GameGlobal.PlayerSelect > 0: - GameGlobal.PlayerSelect -= 1 - -func _on_Male_toggled(button_pressed): - $Gender/Female.pressed = false - Gender = 0 - -func _on_Female_toggled(button_pressed): - $Gender/Male.pressed = false - Gender = 1 - -func add_items(): - $Profession/DropDown.add_item("Hunter") - $Profession/DropDown.add_item("Witch") - $Profession/DropDown.add_item("Farmer") - $Profession/DropDown.add_item("Magician") - - -func _on_DropDown_item_selected(index): - Profession = $Profession/DropDown.get_item_text(index) - - -func _on_Name_text_changed(new_text): - Name = $Name.text diff --git a/Phase2/Godot ===(Game Code)===/CharacterCreation/Scene/CharacterMenu.tscn b/Phase2/Godot ===(Game Code)===/CharacterCreation/Scene/CharacterMenu.tscn index 174cb06..7a0b1d3 100644 --- a/Phase2/Godot ===(Game Code)===/CharacterCreation/Scene/CharacterMenu.tscn +++ b/Phase2/Godot ===(Game Code)===/CharacterCreation/Scene/CharacterMenu.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=10 format=2] -[ext_resource path="res://CharacterMenu.gd" type="Script" id=1] +[ext_resource path="res://Script/CharacterMenu.gd" type="Script" id=1] [ext_resource path="res://Assets/random_characters/hi-tops_idle.png" type="Texture" id=2] [ext_resource path="res://Assets/random_characters/yakuza_idle.png" type="Texture" id=3] [ext_resource path="res://Assets/random_characters/punker.png" type="Texture" id=4] @@ -74,16 +74,14 @@ margin_bottom = 42.0 text = "Right" [node name="Gender" type="VBoxContainer" parent="."] -margin_left = 211.0 -margin_top = 81.0 -margin_right = 251.0 -margin_bottom = 133.0 +margin_left = 227.0 +margin_top = 68.0 +margin_right = 302.0 +margin_bottom = 124.0 rect_scale = Vector2( 0.5, 0.5 ) [node name="TextGender" type="RichTextLabel" parent="Gender"] -margin_top = -10.0 margin_right = 75.0 -margin_bottom = 10.0 text = "Gender" [node name="Male" type="CheckBox" parent="Gender"] @@ -114,22 +112,56 @@ margin_right = 177.0 margin_bottom = 143.0 rect_scale = Vector2( 0.4, 0.4 ) -[node name="DropDown" type="OptionButton" parent="Profession"] +[node name="ProfessionDropDown" type="OptionButton" parent="Profession"] margin_right = 96.0 margin_bottom = 20.0 text = "Profession" +[node name="TribeDropDown" type="OptionButton" parent="Profession"] +margin_top = 24.0 +margin_right = 96.0 +margin_bottom = 44.0 +text = "Tribe" + [node name="Play" type="Button" parent="."] -margin_left = 156.0 -margin_top = 133.0 -margin_right = 194.0 -margin_bottom = 153.0 +margin_left = 160.0 +margin_top = 153.0 +margin_right = 198.0 +margin_bottom = 173.0 disabled = true text = "Play" +[node name="FileExplorer" type="Control" parent="."] +margin_left = 234.0 +margin_top = 108.0 +margin_right = 274.0 +margin_bottom = 148.0 + +[node name="Import" type="Button" parent="FileExplorer"] +margin_right = 66.0 +margin_bottom = 20.0 +rect_scale = Vector2( 0.5, 0.5 ) +text = "Import" + +[node name="FileDialog" type="FileDialog" parent="FileExplorer"] +visible = true +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -170.0 +margin_top = -58.0 +margin_right = 270.0 +margin_bottom = 114.0 +rect_scale = Vector2( 0.3, 0.3 ) +window_title = "Open a File" +mode = 0 +access = 2 + [connection signal="pressed" from="Left" to="." method="_on_Left_pressed"] [connection signal="pressed" from="Right" to="." method="_on_Right_pressed"] [connection signal="toggled" from="Gender/Male" to="." method="_on_Male_toggled"] [connection signal="toggled" from="Gender/Female" to="." method="_on_Female_toggled"] [connection signal="text_changed" from="Name" to="." method="_on_Name_text_changed"] -[connection signal="item_selected" from="Profession/DropDown" to="." method="_on_DropDown_item_selected"] +[connection signal="item_selected" from="Profession/ProfessionDropDown" to="." method="_on_DropDown_item_selected"] +[connection signal="item_selected" from="Profession/TribeDropDown" to="." method="_on_TribeDropDown_item_selected"] +[connection signal="pressed" from="FileExplorer/Import" to="." method="_on_Import_pressed"] +[connection signal="file_selected" from="FileExplorer/FileDialog" to="." method="_on_FileDialog_file_selected"] diff --git a/Phase2/Godot ===(Game Code)===/CharacterCreation/Script/CharacterMenu.gd b/Phase2/Godot ===(Game Code)===/CharacterCreation/Script/CharacterMenu.gd new file mode 100644 index 0000000..fe12b01 --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/CharacterCreation/Script/CharacterMenu.gd @@ -0,0 +1,79 @@ +extends Node2D + +var Gender = -1 +var Name = "" +var Profession = "" +var Tribe = "" + +func _ready(): + profession_add_items() + tribe_add_items() + +func _process(delta): + match GameGlobal.PlayerSelect: + 0: + $PlayerSelect.play("Player0") + 1: + $PlayerSelect.play("Player1") + 2: + $PlayerSelect.play("Player2") + 3: + $PlayerSelect.play("Player3") + 4: + $PlayerSelect.play("Player4") + 5: + $PlayerSelect.play("Player5") + + if fill_check(): + $Play.disabled = false + +func _on_Right_pressed(): + if GameGlobal.PlayerSelect < 5: + GameGlobal.PlayerSelect += 1 + +func _on_Left_pressed(): + if GameGlobal.PlayerSelect > 0: + GameGlobal.PlayerSelect -= 1 + +func _on_Male_toggled(button_pressed): + $Gender/Female.pressed = false + Gender = 0 + +func _on_Female_toggled(button_pressed): + $Gender/Male.pressed = false + Gender = 1 + +func profession_add_items(): + $Profession/ProfessionDropDown.add_item("Hunter") + $Profession/ProfessionDropDown.add_item("Witch") + $Profession/ProfessionDropDown.add_item("Farmer") + $Profession/ProfessionDropDown.add_item("Magician") + +func tribe_add_items(): + $Profession/TribeDropDown.add_item("Hazuka") + $Profession/TribeDropDown.add_item("Ahom") + $Profession/TribeDropDown.add_item("Mising") + $Profession/TribeDropDown.add_item("Kalita") + +func fill_check(): + return Gender != -1 and Name and Profession and Tribe + + +func _on_DropDown_item_selected(index): + Profession = $Profession/ProfessionDropDown.get_item_text(index) + + +func _on_Name_text_changed(new_text): + Name = $Name.text + + +func _on_TribeDropDown_item_selected(index): + Tribe = $Profession/TribeDropDown.get_item_text(index) + + +func _on_Import_pressed(): + $FileExplorer/FileDialog.popup() + + +func _on_FileDialog_file_selected(path): + OS.shell_open(path)