ajout des mutation et refonte de l'inspecteur
* ajout des mutations #86 * changement de l'objectif #85 * refonte de l'inspecteur #71 * changement léger de la plantation * les plantes ne donnent que des graines de leurs espèces * refonte partielle du code, refacto
This commit is contained in:
57
gui/game/inspector/framed_info/framed_info.tscn
Normal file
57
gui/game/inspector/framed_info/framed_info.tscn
Normal file
@@ -0,0 +1,57 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dinju2m0oja38"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_1ddv5"]
|
||||
[ext_resource type="Script" uid="uid://ymn5layeoat8" path="res://gui/game/inspector/framed_info/scripts/framed_info.gd" id="1_7tmbd"]
|
||||
[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="2_7tmbd"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="3_1ddv5"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7tmbd"]
|
||||
bg_color = Color(1, 1, 1, 0.78431374)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_1ddv5"]
|
||||
font = ExtResource("3_1ddv5")
|
||||
font_size = 18
|
||||
|
||||
[node name="FramedInfo" type="PanelContainer"]
|
||||
self_modulate = Color(0.043137256, 0.07450981, 0.14901961, 1)
|
||||
offset_right = 275.0
|
||||
offset_bottom = 94.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_7tmbd")
|
||||
script = ExtResource("1_7tmbd")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_1ddv5")
|
||||
|
||||
[node name="HFlowContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/HFlowContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="MarginContainer/HFlowContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(20, 20)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_7tmbd")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Title" type="Label" parent="MarginContainer/HFlowContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "On mature"
|
||||
label_settings = SubResource("LabelSettings_1ddv5")
|
||||
|
||||
[node name="Desc" type="RichTextLabel" parent="MarginContainer/HFlowContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme = ExtResource("1_1ddv5")
|
||||
bbcode_enabled = true
|
||||
text = "On mature, do this and that and do this and that and do this and that"
|
||||
fit_content = true
|
||||
10
gui/game/inspector/framed_info/scripts/framed_info.gd
Normal file
10
gui/game/inspector/framed_info/scripts/framed_info.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
extends PanelContainer
|
||||
|
||||
var framed_info :Inspector.FramedInfo = null : set = update_framed_info
|
||||
|
||||
func update_framed_info(f: Inspector.FramedInfo):
|
||||
framed_info = f
|
||||
%Icon.texture = f.icon
|
||||
%Title.text = f.title
|
||||
%Desc.text = f.description
|
||||
self_modulate = f.bg_color
|
||||
@@ -0,0 +1 @@
|
||||
uid://ymn5layeoat8
|
||||
@@ -1,11 +1,19 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://d3lff5fui1k0c"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://d3lff5fui1k0c"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_f5bv4"]
|
||||
[ext_resource type="Texture2D" uid="uid://c2pgaklnj5w3d" path="res://gui/game/assets/texture/Tablette info.png" id="2_a8c2j"]
|
||||
[ext_resource type="Texture2D" uid="uid://lpik6kwqgmjx" path="res://gui/game/assets/texture/tablette_resized.png" id="1_qfinp"]
|
||||
[ext_resource type="Script" uid="uid://b36bjfq4sng36" path="res://gui/game/inspector/scripts/inspector.gd" id="3_a8c2j"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="3_qfinp"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="4_yijvw"]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_yijvw"]
|
||||
texture = ExtResource("1_qfinp")
|
||||
texture_margin_left = 30.0
|
||||
texture_margin_top = 10.0
|
||||
texture_margin_right = 30.0
|
||||
texture_margin_bottom = 50.0
|
||||
region_rect = Rect2(18, 31, 240, 334)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ek73b"]
|
||||
atlas = ExtResource("3_qfinp")
|
||||
region = Rect2(76, 75, 124, 135)
|
||||
@@ -14,44 +22,32 @@ region = Rect2(76, 75, 124, 135)
|
||||
font = ExtResource("4_yijvw")
|
||||
font_size = 20
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_n4kem"]
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_c4yiu"]
|
||||
font_size = 12
|
||||
|
||||
[node name="Inspector" type="TextureRect"]
|
||||
custom_minimum_size = Vector2(0, 300)
|
||||
[node name="Inspector" type="PanelContainer"]
|
||||
offset_right = 276.0
|
||||
offset_bottom = 235.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 8
|
||||
theme = ExtResource("1_f5bv4")
|
||||
texture = ExtResource("2_a8c2j")
|
||||
expand_mode = 3
|
||||
stretch_mode = 4
|
||||
size_flags_vertical = 0
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_yijvw")
|
||||
script = ExtResource("3_a8c2j")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
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 = 40
|
||||
theme_override_constants/margin_top = 40
|
||||
theme_override_constants/margin_right = 25
|
||||
theme_override_constants/margin_bottom = 75
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme = ExtResource("1_f5bv4")
|
||||
|
||||
[node name="Texture" type="TextureRect" parent="MarginContainer/VBoxContainer"]
|
||||
[node name="Texture" type="TextureRect" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 50)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
texture = SubResource("AtlasTexture_ek73b")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Title" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
[node name="Title" type="Label" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "fdqsd dqsdq dsqdqsd"
|
||||
@@ -59,11 +55,20 @@ label_settings = SubResource("LabelSettings_ek73b")
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="Desc" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
[node name="StatInfos" type="HFlowContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
text = "Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. "
|
||||
label_settings = SubResource("LabelSettings_n4kem")
|
||||
theme_override_constants/h_separation = 8
|
||||
theme_override_constants/v_separation = 8
|
||||
alignment = 1
|
||||
|
||||
[node name="Desc" type="Label" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Very interesting description that can be very long, like 2 or 3 lines long."
|
||||
label_settings = SubResource("LabelSettings_c4yiu")
|
||||
autowrap_mode = 3
|
||||
clip_text = true
|
||||
|
||||
[node name="FramedInfos" type="VBoxContainer" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
extends Control
|
||||
class_name Inspector
|
||||
|
||||
const FRAMED_INFO_SCENE : PackedScene = preload("res://gui/game/inspector/framed_info/framed_info.tscn")
|
||||
const STAT_INFO_SCENE : PackedScene = preload("res://gui/game/inspector/stat_info/stat_info.tscn")
|
||||
|
||||
var info : Info = null :
|
||||
set(i):
|
||||
info = i
|
||||
@@ -19,11 +22,33 @@ func update_info(i : Info):
|
||||
%Texture.visible = i.texture != null
|
||||
%Title.text = i.title
|
||||
%Desc.text = i.description
|
||||
%Desc.visible = i.description != ""
|
||||
update_framed_infos(info.framed_infos)
|
||||
update_stat_info(info.stat_infos)
|
||||
|
||||
func update_framed_infos(framed_infos : Array[FramedInfo]):
|
||||
for c in %FramedInfos.get_children() :
|
||||
c.queue_free()
|
||||
for i in range(len(framed_infos)):
|
||||
var frame_info_object = FRAMED_INFO_SCENE.instantiate()
|
||||
%FramedInfos.add_child(frame_info_object)
|
||||
frame_info_object.framed_info = framed_infos[i]
|
||||
|
||||
func update_stat_info(stat_infos):
|
||||
%StatInfos.visible = len(stat_infos) != 0
|
||||
for c in %StatInfos.get_children() :
|
||||
c.queue_free()
|
||||
for i in range(len(stat_infos)):
|
||||
var stat_inof_object = STAT_INFO_SCENE.instantiate()
|
||||
%StatInfos.add_child(stat_inof_object)
|
||||
stat_inof_object.stat_info = stat_infos[i]
|
||||
|
||||
class Info:
|
||||
var title : String
|
||||
var texture: Texture
|
||||
var description : String
|
||||
var title : String = ""
|
||||
var texture: Texture = null
|
||||
var description : String = ""
|
||||
var framed_infos : Array[Inspector.FramedInfo] = []
|
||||
var stat_infos = []
|
||||
|
||||
func _init(
|
||||
_title : String = "",
|
||||
@@ -32,4 +57,39 @@ class Info:
|
||||
):
|
||||
title = _title
|
||||
description = _description
|
||||
texture = _texture
|
||||
texture = _texture
|
||||
|
||||
func add_framed_info(framed_info : Inspector.FramedInfo):
|
||||
framed_infos.push_front(framed_info)
|
||||
|
||||
func add_stat_info(s_info : Inspector.StatInfo):
|
||||
stat_infos.push_front(s_info)
|
||||
|
||||
|
||||
class FramedInfo:
|
||||
var title : String
|
||||
var icon: Texture
|
||||
var description : String
|
||||
var bg_color : Color
|
||||
|
||||
func _init(
|
||||
_title : String = "",
|
||||
_desc : String = "",
|
||||
_icon : Texture = null,
|
||||
_bg_color : Color = Color("0B1326")
|
||||
):
|
||||
title = _title
|
||||
description = _desc
|
||||
icon = _icon
|
||||
bg_color = _bg_color
|
||||
|
||||
class StatInfo:
|
||||
var text : String
|
||||
var icon: Texture
|
||||
|
||||
func _init(
|
||||
_text : String = "",
|
||||
_icon : Texture = null,
|
||||
):
|
||||
text = _text
|
||||
icon = _icon
|
||||
|
||||
9
gui/game/inspector/stat_info/scripts/stat_info.gd
Normal file
9
gui/game/inspector/stat_info/scripts/stat_info.gd
Normal file
@@ -0,0 +1,9 @@
|
||||
extends HBoxContainer
|
||||
|
||||
var stat_info : Inspector.StatInfo = null : set = update_stat_info
|
||||
|
||||
func update_stat_info(s_info : Inspector.StatInfo):
|
||||
stat_info = s_info
|
||||
%Icon.texture = stat_info.icon
|
||||
%Text.text = str(stat_info.text)
|
||||
|
||||
1
gui/game/inspector/stat_info/scripts/stat_info.gd.uid
Normal file
1
gui/game/inspector/stat_info/scripts/stat_info.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://yghu53hja4xj
|
||||
28
gui/game/inspector/stat_info/stat_info.tscn
Normal file
28
gui/game/inspector/stat_info/stat_info.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://djihfgtjuhqwy"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://yghu53hja4xj" path="res://gui/game/inspector/stat_info/scripts/stat_info.gd" id="1_4pua2"]
|
||||
[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="2_pdlch"]
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="3_pdlch"]
|
||||
|
||||
[node name="StatInfo" type="HBoxContainer"]
|
||||
theme_override_constants/separation = 4
|
||||
alignment = 1
|
||||
script = ExtResource("1_4pua2")
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(20, 20)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_pdlch")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Text" type="RichTextLabel" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_pdlch")
|
||||
bbcode_enabled = true
|
||||
text = "6"
|
||||
fit_content = true
|
||||
scroll_active = false
|
||||
autowrap_mode = 0
|
||||
Reference in New Issue
Block a user