diff --git a/#Scenes/GalleryItem.tscn b/#Scenes/GalleryItem.tscn new file mode 100644 index 00000000..15fa68f3 --- /dev/null +++ b/#Scenes/GalleryItem.tscn @@ -0,0 +1,77 @@ +[gd_scene load_steps=5 format=3 uid="uid://nr0k304sanb1"] + +[ext_resource type="Script" path="res://#Scenes/SceneScripts/GalleryItem.gd" id="1_c4r4u"] +[ext_resource type="PackedScene" uid="uid://caxbd2ppk3ans" path="res://Cards/Card.tscn" id="2_3mqsx"] + +[sub_resource type="LabelSettings" id="LabelSettings_g4q7d"] +font_size = 28 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_a8tpm"] +bg_color = Color(0.6, 0.6, 0.6, 0) +border_width_left = 5 +border_width_top = 5 +border_width_right = 5 +border_width_bottom = 5 +border_color = Color(0, 0, 0, 1) + +[node name="GalleryItem" type="Node2D" node_paths=PackedStringArray("art_texture_node", "art_author", "art_scroll_container")] +script = ExtResource("1_c4r4u") +art_texture_node = NodePath("ArtContainer/ArtScrollContainer/Art") +art_author = NodePath("ArtContainer/Author") +art_scroll_container = NodePath("ArtContainer") + +[node name="ColorRect" type="ColorRect" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_right = 1920.0 +offset_bottom = 1080.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 0.309804) + +[node name="Back" type="Button" parent="."] +offset_left = 28.0 +offset_top = 18.0 +offset_right = 128.0 +offset_bottom = 68.0 +text = "Back +" + +[node name="Card" parent="." instance=ExtResource("2_3mqsx")] +visible = false +offset_left = 590.0 +offset_top = 60.0 +offset_right = 940.0 +offset_bottom = 530.0 +scale = Vector2(2, 2) + +[node name="ArtContainer" type="Control" parent="."] +visible = false +layout_mode = 3 +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="Author" type="Label" parent="ArtContainer"] +layout_mode = 0 +offset_left = 879.0 +offset_top = 46.0 +offset_right = 974.0 +offset_bottom = 85.0 +text = "Author" +label_settings = SubResource("LabelSettings_g4q7d") + +[node name="ArtScrollContainer" type="ScrollContainer" parent="ArtContainer"] +offset_left = 114.0 +offset_top = 104.0 +offset_right = 1814.0 +offset_bottom = 1004.0 +theme_override_styles/panel = SubResource("StyleBoxFlat_a8tpm") + +[node name="Art" type="TextureRect" parent="ArtContainer/ArtScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 + +[connection signal="pressed" from="Back" to="." method="_back_to_gallery"] diff --git a/#Scenes/GalleryScene.tscn b/#Scenes/GalleryScene.tscn new file mode 100644 index 00000000..dc11163b --- /dev/null +++ b/#Scenes/GalleryScene.tscn @@ -0,0 +1,172 @@ +[gd_scene load_steps=21 format=3 uid="uid://budiktemb6mck"] + +[ext_resource type="Script" path="res://#Scenes/SceneScripts/GalleryMenu.gd" id="1_87kxa"] +[ext_resource type="Texture2D" uid="uid://dvr6ky4vqv4lf" path="res://Art/Enemies/golden_cauldron-finished.png" id="2_nwnkr"] +[ext_resource type="Script" path="res://#Scenes/SceneScripts/GalleryArtInfo.gd" id="2_q254t"] +[ext_resource type="Texture2D" uid="uid://ua4ml58lwg4r" path="res://Art/Enemies/motorized_bears/motorized_bear_leader-finished.png" id="4_5lusa"] +[ext_resource type="Texture2D" uid="uid://qwjhfnceugt0" path="res://Art/Enemies/motorized_bears/motorized_bear_underlings_1-finished.png" id="5_wt8jc"] +[ext_resource type="Texture2D" uid="uid://cw0id8n5qemg8" path="res://Art/Enemies/motorized_bears/motorized_bear_underlings_2-finished.png" id="6_ylaeb"] +[ext_resource type="Script" path="res://#Scenes/SceneScripts/GalleryMusicInfo.gd" id="7_twyl5"] + +[sub_resource type="Resource" id="Resource_pomo2"] +script = ExtResource("2_q254t") +art_name = "Golden Cauldron" +author = "Pterion" +texture = ExtResource("2_nwnkr") + +[sub_resource type="Resource" id="Resource_j3yf8"] +script = ExtResource("2_q254t") +art_name = "Motorized Bear Leader" +author = "Pterion" +texture = ExtResource("4_5lusa") + +[sub_resource type="Resource" id="Resource_o5tj0"] +script = ExtResource("2_q254t") +art_name = "Motorized Bear Underling 1" +author = "Pterion" +texture = ExtResource("5_wt8jc") + +[sub_resource type="Resource" id="Resource_6yf4y"] +script = ExtResource("2_q254t") +art_name = "Motorized Bear Underling 2" +author = "Pterion" +texture = ExtResource("6_ylaeb") + +[sub_resource type="Resource" id="Resource_b1o8k"] +script = ExtResource("7_twyl5") +title = "Area One Theme" +audio_enum = 0 +artist = "Adrian" + +[sub_resource type="Resource" id="Resource_vqv6b"] +script = ExtResource("7_twyl5") +title = "Area Two Theme" +audio_enum = 1 +artist = "Adrian" + +[sub_resource type="Resource" id="Resource_liu02"] +script = ExtResource("7_twyl5") +title = "Area Three Theme" +audio_enum = 2 +artist = "Arkhand" + +[sub_resource type="Resource" id="Resource_jvqx0"] +script = ExtResource("7_twyl5") +title = "Boss Theme" +audio_enum = 3 +artist = "Adrian" + +[sub_resource type="Resource" id="Resource_vnqb1"] +script = ExtResource("7_twyl5") +title = "Heal Theme" +audio_enum = 4 +artist = "Arkhand" + +[sub_resource type="Resource" id="Resource_lvcsn"] +script = ExtResource("7_twyl5") +title = "Shop Theme" +audio_enum = 5 +artist = "Arkhand" + +[sub_resource type="Theme" id="Theme_acrei"] +default_font_size = 28 + +[sub_resource type="Theme" id="Theme_merag"] +default_font_size = 28 + +[sub_resource type="LabelSettings" id="LabelSettings_tf4ep"] +font_size = 28 + +[node name="GalleryScene" type="Node2D" node_paths=PackedStringArray("mobs_box_tab", "cards_box_tab", "music_box_tab", "author_label")] +script = ExtResource("1_87kxa") +mobs_box_tab = NodePath("TabContainer/Mobs/ScrollContainer/MobsGridContainer") +mobs_list = Array[ExtResource("2_q254t")]([SubResource("Resource_pomo2"), SubResource("Resource_j3yf8"), SubResource("Resource_o5tj0"), SubResource("Resource_6yf4y")]) +cards_box_tab = NodePath("TabContainer/Cards/ScrollContainer/CardsGridContainer") +music_box_tab = NodePath("TabContainer/Music/ScrollContainer/MusicGridContainer") +music_list = Array[ExtResource("7_twyl5")]([SubResource("Resource_b1o8k"), SubResource("Resource_vqv6b"), SubResource("Resource_liu02"), SubResource("Resource_jvqx0"), SubResource("Resource_vnqb1"), SubResource("Resource_lvcsn")]) +music_text_theme = SubResource("Theme_acrei") +author_label = NodePath("TabContainer/Music/Author") + +[node name="BackToMainMenu" type="Button" parent="."] +offset_left = 20.0 +offset_top = 40.0 +offset_right = 270.0 +offset_bottom = 115.0 +text = "Back to Main Menu" + +[node name="TextureButton" type="TextureButton" parent="."] +visible = false +offset_left = 160.0 +offset_top = 218.0 +offset_right = 360.0 +offset_bottom = 418.0 +texture_normal = ExtResource("2_nwnkr") +ignore_texture_size = true +stretch_mode = 0 + +[node name="TabContainer" type="TabContainer" parent="."] +offset_left = 160.0 +offset_top = 187.0 +offset_right = 1760.0 +offset_bottom = 987.0 +all_tabs_in_front = true + +[node name="Mobs" type="TabBar" parent="TabContainer"] +visible = false +layout_mode = 2 + +[node name="ScrollContainer" type="ScrollContainer" parent="TabContainer/Mobs"] +layout_mode = 0 +offset_right = 1601.0 +offset_bottom = 768.0 + +[node name="MobsGridContainer" type="GridContainer" parent="TabContainer/Mobs/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +columns = 4 + +[node name="Cards" type="TabBar" parent="TabContainer"] +visible = false +layout_mode = 2 + +[node name="ScrollContainer" type="ScrollContainer" parent="TabContainer/Cards"] +layout_mode = 0 +offset_right = 1601.0 +offset_bottom = 768.0 + +[node name="CardsGridContainer" type="GridContainer" parent="TabContainer/Cards/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +columns = 4 + +[node name="Music" type="TabBar" parent="TabContainer"] +layout_mode = 2 + +[node name="ScrollContainer" type="ScrollContainer" parent="TabContainer/Music"] +custom_minimum_size = Vector2(1601, 768) +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="MusicGridContainer" type="GridContainer" parent="TabContainer/Music/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 6 +columns = 4 + +[node name="LinkButton" type="Button" parent="TabContainer/Music/ScrollContainer/MusicGridContainer"] +visible = false +custom_minimum_size = Vector2(200, 200) +layout_mode = 2 +theme = SubResource("Theme_merag") +text = "Test" + +[node name="Author" type="Label" parent="TabContainer/Music"] +layout_mode = 0 +offset_left = 695.0 +offset_top = 678.0 +offset_right = 790.0 +offset_bottom = 717.0 +label_settings = SubResource("LabelSettings_tf4ep") + +[connection signal="pressed" from="BackToMainMenu" to="." method="_back_to_main_menu_pressed"] +[connection signal="pressed" from="TextureButton" to="." method="_go_to_gallery_item"] diff --git a/#Scenes/MainMenu.tscn b/#Scenes/MainMenu.tscn index 91735d15..0c1e6fca 100644 --- a/#Scenes/MainMenu.tscn +++ b/#Scenes/MainMenu.tscn @@ -51,9 +51,9 @@ text = "Title place holder" [node name="Menu buttons" type="VBoxContainer" parent="."] layout_mode = 0 offset_left = 25.0 -offset_top = 481.0 +offset_top = 388.0 offset_right = 465.0 -offset_bottom = 1162.0 +offset_bottom = 1069.0 focus_mode = 2 theme_override_constants/separation = -195 alignment = 1 @@ -113,6 +113,15 @@ texture_focused = ExtResource("12_eqc6b") ignore_texture_size = true stretch_mode = 4 +[node name="Gallery" type="Button" parent="."] +layout_mode = 2 +offset_left = 69.0 +offset_top = 929.0 +offset_right = 434.0 +offset_bottom = 999.0 +text = "Gallery +" + [node name="StartNewGameDialog" type="ConfirmationDialog" parent="."] title = "" initial_position = 4 @@ -127,4 +136,5 @@ cancel_button_text = "No" [connection signal="pressed" from="Menu buttons/Options" to="." method="_on_options_pressed"] [connection signal="pressed" from="Menu buttons/Credits" to="." method="_on_credits_pressed"] [connection signal="pressed" from="Menu buttons/Quit" to="." method="_on_quit_pressed"] +[connection signal="pressed" from="Gallery" to="." method="_on_gallery_pressed"] [connection signal="confirmed" from="StartNewGameDialog" to="." method="_on_start_new_game_dialog_confirmed"] diff --git a/#Scenes/SceneScripts/GalleryArtInfo.gd b/#Scenes/SceneScripts/GalleryArtInfo.gd new file mode 100644 index 00000000..a73c5d92 --- /dev/null +++ b/#Scenes/SceneScripts/GalleryArtInfo.gd @@ -0,0 +1,6 @@ +extends GalleryInfo +class_name GalleryArtInfo + +@export var art_name: String +@export var author: String +@export var texture: Texture2D diff --git a/#Scenes/SceneScripts/GalleryCardInfo.gd b/#Scenes/SceneScripts/GalleryCardInfo.gd new file mode 100644 index 00000000..f5396a7f --- /dev/null +++ b/#Scenes/SceneScripts/GalleryCardInfo.gd @@ -0,0 +1,4 @@ +extends GalleryInfo +class_name GalleryCardInfo + +@export var card_resource: Resource diff --git a/#Scenes/SceneScripts/GalleryInfo.gd b/#Scenes/SceneScripts/GalleryInfo.gd new file mode 100644 index 00000000..d1e403f0 --- /dev/null +++ b/#Scenes/SceneScripts/GalleryInfo.gd @@ -0,0 +1,2 @@ +extends Resource +class_name GalleryInfo diff --git a/#Scenes/SceneScripts/GalleryItem.gd b/#Scenes/SceneScripts/GalleryItem.gd new file mode 100644 index 00000000..24f7c0ac --- /dev/null +++ b/#Scenes/SceneScripts/GalleryItem.gd @@ -0,0 +1,28 @@ +extends Node2D +class_name GalleryItem + +@onready var card: PackedScene = preload("res://Cards/Card.tscn") + +# Take in information of type of material to show +# Card, Art, or Sapling Message +# Create Different objects for the different materials, then show/hide based on the material we want to show +@export var art_texture_node: TextureRect +@export var art_author: Label +@export var art_scroll_container: Control + +var gallery_info: GalleryInfo = null + +func _ready() -> void: + if gallery_info is GalleryArtInfo: + art_scroll_container.visible = true + art_author.text = "Art by: " + gallery_info.author + art_texture_node.texture = gallery_info.texture + elif gallery_info is GalleryCardInfo: + var card_world: CardWorld = card.instantiate() + card_world.card_data = load(gallery_info.card_resource.resource_path) + card_world.position = Vector2(590, 60) + card_world.scale = Vector2(2, 2) + add_child(card_world) + +func _back_to_gallery() -> void: + queue_free() diff --git a/#Scenes/SceneScripts/GalleryMenu.gd b/#Scenes/SceneScripts/GalleryMenu.gd new file mode 100644 index 00000000..2d259349 --- /dev/null +++ b/#Scenes/SceneScripts/GalleryMenu.gd @@ -0,0 +1,66 @@ +extends Node + +@onready var gallery_item_scene: PackedScene = preload("res://#Scenes/GalleryItem.tscn") +@onready var card: PackedScene = preload("res://Cards/Card.tscn") + +@export var mobs_box_tab: Control +@export var mobs_list: Array[GalleryArtInfo] + +@export var cards_box_tab: Control + +@export var music_box_tab: Control +@export var music_list: Array[GalleryMusicInfo] +@export var music_text_theme: Theme +@export var author_label: Label + +func _ready() -> void: + _populate_mobs_tab() + _populate_cards_tab() + _populate_music_tab() + +func _back_to_main_menu_pressed() -> void: + SceneManager.goto_scene("res://#Scenes/MainMenu.tscn") + +func _go_to_gallery_item(gallery_info: GalleryInfo) -> void: + var gallery_item: GalleryItem = gallery_item_scene.instantiate() + gallery_item.gallery_info = gallery_info + + get_parent().add_child(gallery_item) + +func _populate_mobs_tab() -> void: + var mob_texture_button_size: Vector2 = Vector2(400, 400) + for mobs in mobs_list: + var texture_button: TextureButton = TextureButton.new() + texture_button.ignore_texture_size = true + texture_button.stretch_mode = TextureButton.STRETCH_SCALE + texture_button.custom_minimum_size = mob_texture_button_size + texture_button.texture_normal = mobs.texture + texture_button.pressed.connect(_go_to_gallery_item.bind(mobs)) + mobs_box_tab.add_child(texture_button) + +func _populate_cards_tab() -> void: + var cards_list: Array[GalleryCardInfo] + for card_resource_file in DirAccess.get_files_at("res://Cards/Resource/"): + var gallery_card_info: GalleryCardInfo = GalleryCardInfo.new() + gallery_card_info.card_resource = load("res://Cards/Resource/" + card_resource_file) + cards_list.append(gallery_card_info) + + for cards in cards_list: + var card_world: CardWorld = card.instantiate() + card_world.card_data = load(cards.card_resource.resource_path) + card_world.get_click_handler().on_click.connect(_go_to_gallery_item.bind(cards)) + cards_box_tab.add_child(card_world) + +func _populate_music_tab() -> void: + for music in music_list: + var link_button: Button = Button.new() + link_button.custom_minimum_size = Vector2(200, 100) + link_button.theme = music_text_theme + link_button.text = music.title + link_button.pressed.connect(_play_music.bind(music)) + music_box_tab.add_child(link_button) + +func _play_music(gallery_music_info: GalleryMusicInfo) -> void: + AudioManager.start_music(gallery_music_info.audio_enum) + author_label.text = "Composed By " + gallery_music_info.artist + author_label.visible = true diff --git a/#Scenes/SceneScripts/GalleryMusicInfo.gd b/#Scenes/SceneScripts/GalleryMusicInfo.gd new file mode 100644 index 00000000..2b5b2486 --- /dev/null +++ b/#Scenes/SceneScripts/GalleryMusicInfo.gd @@ -0,0 +1,6 @@ +extends GalleryInfo +class_name GalleryMusicInfo + +@export var title: String +@export var audio_enum: GlobalEnums.MusicTrack +@export var artist: String diff --git a/#Scenes/SceneScripts/MainMenu.gd b/#Scenes/SceneScripts/MainMenu.gd index 59890484..9e942c42 100644 --- a/#Scenes/SceneScripts/MainMenu.gd +++ b/#Scenes/SceneScripts/MainMenu.gd @@ -51,6 +51,8 @@ func _on_options_pressed() -> void: func _on_quit_pressed() -> void: get_tree().quit() +func _on_gallery_pressed() -> void: + SceneManager.goto_scene("res://#Scenes/GalleryScene.tscn") ## Go to the credits func _on_credits_pressed() -> void: