create game_menu, page generic, page_1, page_2 and relatives widgets
This commit is contained in:
@@ -2,30 +2,56 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://bj34o0org55ei" path="res://core/photo_mode/data/collectible_resource.gd" id="1_3cgvf"]
|
||||
[ext_resource type="Script" uid="uid://hhuufh87skq5" path="res://core/photo_mode/data/collectible_library.gd" id="2_ggu10"]
|
||||
[ext_resource type="Texture2D" uid="uid://cx8d233y32kmu" path="res://icon.svg" id="2_pxmdy"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_3cgvf"]
|
||||
script = ExtResource("1_3cgvf")
|
||||
id = &"cane"
|
||||
title = "Cane"
|
||||
image = ExtResource("2_pxmdy")
|
||||
metadata/_custom_type_script = "uid://bj34o0org55ei"
|
||||
[ext_resource type="Texture2D" uid="uid://cusgi1mpq5rn" path="res://core/game_menu/assets/page_2/dog_animals_collection.png" id="2_hgshs"]
|
||||
[ext_resource type="Texture2D" uid="uid://dsvu86m5la1tp" path="res://core/game_menu/assets/page_2/cat_animals_collection.png" id="3_sj2nd"]
|
||||
[ext_resource type="Texture2D" uid="uid://dl04xh8e35xyd" path="res://core/game_menu/assets/page_2/crow_animals_collection.png" id="4_6l4cv"]
|
||||
[ext_resource type="Texture2D" uid="uid://calno16l7x4wq" path="res://core/game_menu/assets/page_2/pigeon_animals_collection.png" id="4_hgshs"]
|
||||
[ext_resource type="Texture2D" uid="uid://ck36h88n5tebw" path="res://core/game_menu/assets/page_2/turtle_animals_collection.png" id="6_b7fb6"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2li830dm14ur" path="res://core/game_menu/assets/page_2/squirrel_animals_collection.png" id="6_cxbng"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ggu10"]
|
||||
script = ExtResource("1_3cgvf")
|
||||
id = &"gatto"
|
||||
title = "Gatto"
|
||||
image = ExtResource("2_pxmdy")
|
||||
id = &"Cat"
|
||||
title = "Cat"
|
||||
image = ExtResource("3_sj2nd")
|
||||
metadata/_custom_type_script = "uid://bj34o0org55ei"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_3cgvf"]
|
||||
script = ExtResource("1_3cgvf")
|
||||
id = &"dog"
|
||||
title = "Dog"
|
||||
image = ExtResource("2_hgshs")
|
||||
metadata/_custom_type_script = "uid://bj34o0org55ei"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_pxmdy"]
|
||||
script = ExtResource("1_3cgvf")
|
||||
id = &"farfalla"
|
||||
title = "Farfalla"
|
||||
image = ExtResource("2_pxmdy")
|
||||
id = &"pigeon"
|
||||
title = "Pigeon"
|
||||
image = ExtResource("4_hgshs")
|
||||
metadata/_custom_type_script = "uid://bj34o0org55ei"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_w26i4"]
|
||||
script = ExtResource("1_3cgvf")
|
||||
id = &"crow"
|
||||
title = "Crow"
|
||||
image = ExtResource("4_6l4cv")
|
||||
metadata/_custom_type_script = "uid://bj34o0org55ei"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_sj2nd"]
|
||||
script = ExtResource("1_3cgvf")
|
||||
id = &"turtle"
|
||||
title = "Turtle"
|
||||
image = ExtResource("6_b7fb6")
|
||||
metadata/_custom_type_script = "uid://bj34o0org55ei"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6l4cv"]
|
||||
script = ExtResource("1_3cgvf")
|
||||
id = &"squirrel"
|
||||
title = "Squirrel"
|
||||
image = ExtResource("6_cxbng")
|
||||
metadata/_custom_type_script = "uid://bj34o0org55ei"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_ggu10")
|
||||
collectibles = Array[ExtResource("1_3cgvf")]([SubResource("Resource_3cgvf"), SubResource("Resource_ggu10"), SubResource("Resource_pxmdy")])
|
||||
collectibles = Array[ExtResource("1_3cgvf")]([SubResource("Resource_ggu10"), SubResource("Resource_3cgvf"), SubResource("Resource_pxmdy"), SubResource("Resource_w26i4"), SubResource("Resource_sj2nd"), SubResource("Resource_6l4cv")])
|
||||
metadata/_custom_type_script = "uid://hhuufh87skq5"
|
||||
|
||||
@@ -29,7 +29,7 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("toggle_photo_mode"):
|
||||
is_active = !is_active
|
||||
|
||||
get_tree().paused = is_active
|
||||
#get_tree().paused = is_active
|
||||
|
||||
if !is_active:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
extends Control
|
||||
|
||||
@export var collectible_ui_scene: PackedScene
|
||||
|
||||
@onready var grid_container: GridContainer = $%CollectibleGrid
|
||||
|
||||
func _ready() -> void:
|
||||
CollectionManager.on_collectible_unlocked.connect(_unlock_collectible)
|
||||
setup()
|
||||
|
||||
func setup() -> void:
|
||||
var unlocked_collectible_ids = CollectionManager.get_unlocked_collectible_ids()
|
||||
var collectibles = CollectionManager.get_all_collectibles()
|
||||
|
||||
for child in grid_container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
for collectible in collectibles:
|
||||
_add_collectible(collectible)
|
||||
if unlocked_collectible_ids.has(collectible.id):
|
||||
_unlock_collectible(collectible.id)
|
||||
|
||||
func on_collectible_unlocked(collectible_id: StringName) -> void:
|
||||
_unlock_collectible(collectible_id)
|
||||
|
||||
func _add_collectible(collectible: CollectibleResource) -> void:
|
||||
var collectible_ui: CollectibleUI = collectible_ui_scene.instantiate()
|
||||
collectible_ui.setup(collectible)
|
||||
grid_container.add_child(collectible_ui)
|
||||
|
||||
func _unlock_collectible(collectible_id: StringName) -> void:
|
||||
for collectible_ui in grid_container.get_children():
|
||||
if collectible_ui.collectible_resource.id == collectible_id:
|
||||
collectible_ui.unlock()
|
||||
@@ -1 +0,0 @@
|
||||
uid://dq3qtcrdnikl7
|
||||
@@ -1,50 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://bvw086glfpcba"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dq3qtcrdnikl7" path="res://core/photo_mode/ui/collectible_gallery.gd" id="1_67tug"]
|
||||
[ext_resource type="PackedScene" uid="uid://dp7dvfauh5rpx" path="res://core/photo_mode/ui/collectible_ui.tscn" id="2_or234"]
|
||||
|
||||
[node name="CollectibleGallery" type="Control" unique_id=354419843]
|
||||
layout_mode = 3
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_67tug")
|
||||
collectible_ui_scene = ExtResource("2_or234")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="." unique_id=640179265]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -350.0
|
||||
offset_top = -350.0
|
||||
offset_right = 350.0
|
||||
offset_bottom = 350.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer" unique_id=125147979]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 12
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer" unique_id=348576028]
|
||||
layout_mode = 2
|
||||
draw_focus_border = true
|
||||
|
||||
[node name="CollectibleGrid" type="GridContainer" parent="PanelContainer/MarginContainer/ScrollContainer" unique_id=1187865988]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 6
|
||||
size_flags_vertical = 2
|
||||
theme_override_constants/h_separation = 12
|
||||
theme_override_constants/v_separation = 12
|
||||
columns = 3
|
||||
@@ -1,22 +0,0 @@
|
||||
extends Control
|
||||
|
||||
class_name CollectibleUI
|
||||
|
||||
@onready var label: Label = $%CollectibleName
|
||||
@onready var texture_rect: TextureRect = $%CollectibleTexture
|
||||
var collectible_resource: CollectibleResource
|
||||
|
||||
func setup(collectible: CollectibleResource) -> void:
|
||||
collectible_resource = collectible
|
||||
if !label:
|
||||
label = $%CollectibleName
|
||||
label.text = collectible_resource.title
|
||||
if collectible.image:
|
||||
if !texture_rect:
|
||||
texture_rect = $%CollectibleTexture
|
||||
texture_rect.texture = collectible_resource.image
|
||||
|
||||
func unlock() -> void:
|
||||
if !texture_rect:
|
||||
texture_rect = $%CollectibleTexture
|
||||
texture_rect.set_modulate(Color(1,1,1,1))
|
||||
@@ -1 +0,0 @@
|
||||
uid://dxh8e1n16qjpp
|
||||
@@ -1,49 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://dp7dvfauh5rpx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dxh8e1n16qjpp" path="res://core/photo_mode/ui/collectible_ui.gd" id="1_tu5nx"]
|
||||
[ext_resource type="Texture2D" uid="uid://cx8d233y32kmu" path="res://icon.svg" id="1_x3wje"]
|
||||
|
||||
[node name="CollectibleUI" type="Control" unique_id=201865221]
|
||||
custom_minimum_size = Vector2(200, 200)
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 200.0
|
||||
script = ExtResource("1_tu5nx")
|
||||
|
||||
[node name="Panel" type="PanelContainer" parent="." unique_id=1372516531]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Panel" unique_id=1141643525]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 12
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer" unique_id=1841409877]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="CollectibleName" type="Label" parent="Panel/MarginContainer/VBoxContainer" unique_id=117774359]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
text = "Collectible"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Panel/MarginContainer/VBoxContainer" unique_id=1345822244]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CollectibleTexture" type="TextureRect" parent="Panel/MarginContainer/VBoxContainer" unique_id=506844785]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(0.16206557, 0.1620656, 0.16206557, 1)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
texture = ExtResource("1_x3wje")
|
||||
stretch_mode = 3
|
||||
@@ -1,11 +0,0 @@
|
||||
extends Control
|
||||
|
||||
class_name Photo
|
||||
|
||||
@onready var texture_rect: TextureRect = $%PhotoTexture
|
||||
|
||||
func setup(texture: Texture) -> void:
|
||||
if texture:
|
||||
if !texture_rect:
|
||||
texture_rect = $%PhotoTexture
|
||||
texture_rect.texture = texture
|
||||
@@ -1 +0,0 @@
|
||||
uid://dsey5dvc11vpq
|
||||
@@ -1,38 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://cvus62qkop3qi"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dsey5dvc11vpq" path="res://core/photo_mode/ui/photo.gd" id="1_u0arp"]
|
||||
|
||||
[node name="Photo" type="Control" unique_id=201865221]
|
||||
custom_minimum_size = Vector2(200, 200)
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 200.0
|
||||
script = ExtResource("1_u0arp")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=1208008621]
|
||||
layout_mode = 0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 200.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="ColorRect" unique_id=1141643525]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 12
|
||||
|
||||
[node name="Panel" type="PanelContainer" parent="ColorRect/MarginContainer" unique_id=1372516531]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PhotoTexture" type="TextureRect" parent="ColorRect/MarginContainer/Panel" unique_id=506844785]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
expand_mode = 1
|
||||
stretch_mode = 6
|
||||
@@ -1,27 +0,0 @@
|
||||
extends Control
|
||||
|
||||
@export var photo_scene: PackedScene
|
||||
|
||||
@onready var grid_container: GridContainer = $%PhotoGrid
|
||||
|
||||
func _ready() -> void:
|
||||
CollectionManager.on_photo_saved.connect(_create_photo_thumbnail)
|
||||
load_gallery()
|
||||
|
||||
func load_gallery() -> void:
|
||||
for child in grid_container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
var saved_photos = CollectionManager.saved_photos
|
||||
|
||||
for file_path in saved_photos:
|
||||
if FileAccess.file_exists(file_path):
|
||||
_create_photo_thumbnail(file_path)
|
||||
|
||||
func _create_photo_thumbnail(file_path: String) -> void:
|
||||
var image = Image.load_from_file(file_path)
|
||||
if image:
|
||||
var photo: Photo = photo_scene.instantiate()
|
||||
var texture = ImageTexture.create_from_image(image)
|
||||
photo.setup(texture)
|
||||
grid_container.add_child(photo)
|
||||
@@ -1 +0,0 @@
|
||||
uid://k4iqrlkbjppl
|
||||
@@ -1,50 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://b6r787sik5yil"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://k4iqrlkbjppl" path="res://core/photo_mode/ui/photo_gallery.gd" id="1_bp5uf"]
|
||||
[ext_resource type="PackedScene" uid="uid://cvus62qkop3qi" path="res://core/photo_mode/ui/photo.tscn" id="2_45wok"]
|
||||
|
||||
[node name="PhotoGallery" type="Control" unique_id=354419843]
|
||||
layout_mode = 3
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_bp5uf")
|
||||
photo_scene = ExtResource("2_45wok")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="." unique_id=640179265]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -350.0
|
||||
offset_top = -350.0
|
||||
offset_right = 350.0
|
||||
offset_bottom = 350.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer" unique_id=125147979]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 12
|
||||
theme_override_constants/margin_top = 12
|
||||
theme_override_constants/margin_right = 12
|
||||
theme_override_constants/margin_bottom = 12
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer" unique_id=348576028]
|
||||
layout_mode = 2
|
||||
draw_focus_border = true
|
||||
|
||||
[node name="PhotoGrid" type="GridContainer" parent="PanelContainer/MarginContainer/ScrollContainer" unique_id=1187865988]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 6
|
||||
size_flags_vertical = 2
|
||||
theme_override_constants/h_separation = 12
|
||||
theme_override_constants/v_separation = 12
|
||||
columns = 3
|
||||
Reference in New Issue
Block a user