garden layout tool
This commit is contained in:
@@ -19,6 +19,12 @@ const lesson_button_texture: = preload("res://assets/gardens/buttons/lesson_dot_
|
||||
%Button3,
|
||||
%Button4,
|
||||
]
|
||||
@onready var lesson_labels: Array[Label] = [
|
||||
%LessonLabel1,
|
||||
%LessonLabel2,
|
||||
%LessonLabel3,
|
||||
%LessonLabel4,
|
||||
]
|
||||
|
||||
|
||||
@export var garden_layout: GardenLayout:
|
||||
@@ -46,7 +52,7 @@ func set_flowers(p_flowers: Array[GardenLayout.Flower]) -> void:
|
||||
var flower_control: = flower_controls[i]
|
||||
flower_control.texture = load(flower_path_model % [flower.color+1, flower.type+1, "Large"])
|
||||
flower_control.position = flower.position
|
||||
flower_control.size = flower_control.get_combined_minimum_size() * 2
|
||||
flower_control.size = flower_control.get_combined_minimum_size() * 3
|
||||
|
||||
|
||||
func set_lesson_buttons(p_lesson_buttons: Array[GardenLayout.LessonButton]) -> void:
|
||||
@@ -58,7 +64,7 @@ func set_lesson_buttons(p_lesson_buttons: Array[GardenLayout.LessonButton]) -> v
|
||||
var lesson_button: = p_lesson_buttons[i]
|
||||
var lesson_button_control: = lesson_button_controls[i]
|
||||
lesson_button_control.texture = lesson_button_texture
|
||||
lesson_button_control.size = lesson_button_control.get_combined_minimum_size() * 2
|
||||
lesson_button_control.size = lesson_button_control.get_combined_minimum_size() * 3
|
||||
lesson_button_control.position = Vector2(lesson_button.position) - lesson_button_control.size / 4
|
||||
|
||||
|
||||
@@ -70,3 +76,8 @@ func set_background(p_color: int) -> void:
|
||||
|
||||
func _ready() -> void:
|
||||
set_garden_layout(garden_layout)
|
||||
|
||||
|
||||
func set_lesson_label(ind: int, text: String) -> void:
|
||||
assert(ind < lesson_labels.size())
|
||||
lesson_labels[ind].text = text
|
||||
|
||||
+153
-15
@@ -1,9 +1,8 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://mf4fc4l3dkrn"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://mf4fc4l3dkrn"]
|
||||
|
||||
[ext_resource type="Script" path="res://resources/gardens/garden.gd" id="1_5owem"]
|
||||
[ext_resource type="Script" path="res://resources/gardens/garden_layout.gd" id="2_8g7o4"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5kildofgmthb" path="res://assets/gardens/gardens/garden_01_open.png" id="3_p7iv3"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfkmukbjgra7d" path="res://assets/gardens/flowers/Plant_03_01_Large.png" id="3_qrxjm"]
|
||||
[ext_resource type="Texture2D" uid="uid://drryj0dlw5amd" path="res://assets/gardens/buttons/lesson_dot_front.png" id="5_bd2im"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_pwltf"]
|
||||
@@ -55,32 +54,175 @@ mouse_filter = 2
|
||||
|
||||
[node name="Button1" type="TextureRect" parent="Buttons"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 0
|
||||
offset_right = 100.0
|
||||
offset_bottom = 100.0
|
||||
offset_left = -50.0
|
||||
offset_top = -50.0
|
||||
offset_right = 150.0
|
||||
offset_bottom = 150.0
|
||||
texture = ExtResource("5_bd2im")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Buttons/Button1"]
|
||||
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 = 30
|
||||
theme_override_constants/margin_top = 30
|
||||
theme_override_constants/margin_right = 30
|
||||
theme_override_constants/margin_bottom = 30
|
||||
|
||||
[node name="Button" type="TextureRect" parent="Buttons/Button1/MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(0.113725, 0.0980392, 0.384314, 1)
|
||||
z_index = 1
|
||||
layout_mode = 2
|
||||
texture = ExtResource("5_bd2im")
|
||||
|
||||
[node name="LessonLabel1" type="Label" parent="Buttons/Button1"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 10
|
||||
theme_override_font_sizes/font_size = 110
|
||||
text = "Ga"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Button2" type="TextureRect" parent="Buttons"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 0
|
||||
offset_left = 500.0
|
||||
offset_right = 668.0
|
||||
offset_bottom = 229.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Buttons/Button2"]
|
||||
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 = 30
|
||||
theme_override_constants/margin_top = 30
|
||||
theme_override_constants/margin_right = 30
|
||||
theme_override_constants/margin_bottom = 30
|
||||
|
||||
[node name="Button" type="TextureRect" parent="Buttons/Button2/MarginContainer"]
|
||||
modulate = Color(0.113725, 0.0980392, 0.384314, 1)
|
||||
z_index = 1
|
||||
layout_mode = 2
|
||||
texture = ExtResource("5_bd2im")
|
||||
|
||||
[node name="LessonLabel2" type="Label" parent="Buttons/Button2"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 10
|
||||
theme_override_font_sizes/font_size = 110
|
||||
text = "Ga"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Button3" type="TextureRect" parent="Buttons"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 0
|
||||
offset_left = 500.0
|
||||
offset_right = 668.0
|
||||
offset_bottom = 229.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Buttons/Button3"]
|
||||
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 = 30
|
||||
theme_override_constants/margin_top = 30
|
||||
theme_override_constants/margin_right = 30
|
||||
theme_override_constants/margin_bottom = 30
|
||||
|
||||
[node name="Button" type="TextureRect" parent="Buttons/Button3/MarginContainer"]
|
||||
modulate = Color(0.113725, 0.0980392, 0.384314, 1)
|
||||
z_index = 1
|
||||
layout_mode = 2
|
||||
texture = ExtResource("5_bd2im")
|
||||
|
||||
[node name="LessonLabel3" type="Label" parent="Buttons/Button3"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 10
|
||||
theme_override_font_sizes/font_size = 110
|
||||
text = "Ga"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Button4" type="TextureRect" parent="Buttons"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 0
|
||||
offset_left = 500.0
|
||||
offset_right = 668.0
|
||||
offset_bottom = 229.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Buttons/Button4"]
|
||||
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 = 30
|
||||
theme_override_constants/margin_top = 30
|
||||
theme_override_constants/margin_right = 30
|
||||
theme_override_constants/margin_bottom = 30
|
||||
|
||||
[node name="Button" type="TextureRect" parent="Buttons/Button4/MarginContainer"]
|
||||
modulate = Color(0.113725, 0.0980392, 0.384314, 1)
|
||||
z_index = 1
|
||||
layout_mode = 2
|
||||
texture = ExtResource("5_bd2im")
|
||||
|
||||
[node name="LessonLabel4" type="Label" parent="Buttons/Button4"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 10
|
||||
theme_override_font_sizes/font_size = 110
|
||||
text = "Ga"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Flowers" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
@@ -92,39 +234,35 @@ mouse_filter = 2
|
||||
|
||||
[node name="Flower1" type="TextureRect" parent="Flowers"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
z_index = 2
|
||||
layout_mode = 0
|
||||
offset_left = 500.0
|
||||
offset_right = 668.0
|
||||
offset_bottom = 229.0
|
||||
texture = ExtResource("3_qrxjm")
|
||||
expand_mode = 1
|
||||
stretch_mode = 4
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="Flower2" type="TextureRect" parent="Flowers"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
z_index = 2
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="Flower3" type="TextureRect" parent="Flowers"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
z_index = 2
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="Flower4" type="TextureRect" parent="Flowers"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
z_index = 2
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="Flower5" type="TextureRect" parent="Flowers"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
z_index = 2
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
@@ -8,7 +8,7 @@ class Flower:
|
||||
var type: = 0
|
||||
var position: = Vector2i.ZERO
|
||||
|
||||
func _init(p_color: int, p_type: int, p_position: Vector2i) -> void:
|
||||
func _init(p_color: int = 0, p_type: int = 0, p_position: Vector2i = Vector2i.ZERO) -> void:
|
||||
color = p_color
|
||||
type = p_type
|
||||
position = p_position
|
||||
@@ -28,7 +28,7 @@ class LessonButton:
|
||||
var position: = Vector2i.ZERO
|
||||
var path_out_position: = Vector2i.ZERO
|
||||
|
||||
func _init(p_position: Vector2i, p_path_out_position: Vector2i) -> void:
|
||||
func _init(p_position: Vector2i = Vector2i.ZERO, p_path_out_position: Vector2i = Vector2i.ZERO) -> void:
|
||||
position = p_position
|
||||
path_out_position = p_path_out_position
|
||||
|
||||
|
||||
Reference in New Issue
Block a user