refonte de l'inspecteur #61
This commit is contained in:
parent
6687235094
commit
655b875759
@ -8,7 +8,7 @@
|
||||
script = ExtResource("1_x02bb")
|
||||
scene = ExtResource("2_uulso")
|
||||
name = "Compost"
|
||||
description = "Compost"
|
||||
description = "The compost allow you to upgrade your max energy when putting in it a certain amount of seeds."
|
||||
icon = ExtResource("1_lhhdv")
|
||||
use_zone_radius = 5
|
||||
use_energy = 1
|
||||
|
||||
@ -22,13 +22,26 @@ func _ready():
|
||||
if item and object_sprite:
|
||||
object_sprite.apply_texture_to_sprite(item.icon, ITEM_SPRITE_SIZE)
|
||||
|
||||
func pointer_text():
|
||||
var name_suffix = ""
|
||||
|
||||
func inspected_text():
|
||||
return item.name + (" Seed" if item is Seed else "")
|
||||
if item is Seed:
|
||||
name_suffix = "Seed"
|
||||
if item is Package:
|
||||
name_suffix = "Package"
|
||||
|
||||
return item.name + (" " + name_suffix if name_suffix else "")
|
||||
|
||||
func interact_text():
|
||||
return "Take"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
item.description,
|
||||
item.icon
|
||||
)
|
||||
|
||||
func interact(player : Player) -> bool:
|
||||
var swapped_item = player.inventory.get_item()
|
||||
|
||||
|
||||
@ -7,12 +7,18 @@ var fill_value : float = 0.
|
||||
func _process(_delta):
|
||||
%ProgressBar.value = lerp(%ProgressBar.value, fill_value * 100, 0.5)
|
||||
|
||||
func inspected_text():
|
||||
func pointer_text():
|
||||
return "Compost"
|
||||
|
||||
func interact_text():
|
||||
return "Put a seed ("+str(roundi((1-fill_value)/value_per_seed))+" left)"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
"The compost allow you to upgrade your max energy when putting in it a certain amount of seeds."
|
||||
)
|
||||
|
||||
func can_interact(p : Player) -> bool:
|
||||
return p.inventory.get_item() and p.inventory.get_item() is Seed
|
||||
|
||||
|
||||
@ -10,4 +10,13 @@ func interact(_p: Player) -> bool:
|
||||
return true
|
||||
|
||||
func interact_text():
|
||||
return "Recharge"
|
||||
return "Recharge"
|
||||
|
||||
func pointer_text():
|
||||
return "Recharge Station"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
"You can recharge your robot here. When recharging, time will pass and plants may grow."
|
||||
)
|
||||
@ -22,6 +22,3 @@ func generate_collision(area_width : float) -> CollisionShape2D:
|
||||
add_child(collision)
|
||||
|
||||
return collision
|
||||
|
||||
func interact_text():
|
||||
return ""
|
||||
|
||||
@ -23,11 +23,18 @@ func _init(_plant_type = null, _planet = null):
|
||||
plant_type = _plant_type
|
||||
planet = _planet
|
||||
|
||||
func inspected_text():
|
||||
func pointer_text():
|
||||
var state_text = "Growing"
|
||||
if state == State.MATURE: state_text = "Mature"
|
||||
return state_text + " " + plant_type.name
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text(),
|
||||
plant_type.description,
|
||||
get_state_texture(State.MATURE)
|
||||
)
|
||||
|
||||
func generate_sprite() -> PlantSprite:
|
||||
var spriteObject : PlantSprite = SPRITE_SCENE.instantiate()
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=24 format=3 uid="uid://bgvbgeq46wee2"]
|
||||
[gd_scene load_steps=26 format=3 uid="uid://bgvbgeq46wee2"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://das7twcy5153p" path="res://entities/player/scripts/player.gd" id="1_abrql"]
|
||||
[ext_resource type="Texture2D" uid="uid://c7ff87jniga5m" path="res://entities/player/assets/sprites/robot.png" id="1_symyc"]
|
||||
@ -23,6 +23,15 @@ radius = 27.0
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_abrql"]
|
||||
radius = 40.0
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_yqrof"]
|
||||
colors = PackedColorArray(0.145098, 0.423529, 0.635294, 1, 0.12549, 0.294118, 0.545098, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_3wlsy"]
|
||||
gradient = SubResource("Gradient_yqrof")
|
||||
fill = 1
|
||||
fill_from = Vector2(0.5, 0.380342)
|
||||
fill_to = Vector2(1, 0.0726496)
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_wq0jh"]
|
||||
random_pitch = 1.5
|
||||
streams_count = 3
|
||||
@ -59,17 +68,6 @@ stream_0/stream = ExtResource("15_gx6sm")
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
script = ExtResource("1_abrql")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
position = Vector2(2, -46)
|
||||
scale = Vector2(0.08, 0.08)
|
||||
texture = ExtResource("1_symyc")
|
||||
|
||||
[node name="ItemSprite" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(0, 5)
|
||||
texture = ExtResource("3_yqrof")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-2, -18)
|
||||
shape = SubResource("CircleShape2D_sglur")
|
||||
@ -80,6 +78,26 @@ position = Vector2(0, -12)
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractArea2D"]
|
||||
shape = SubResource("CircleShape2D_abrql")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -46)
|
||||
scale = Vector2(0.08, 0.08)
|
||||
texture = ExtResource("1_symyc")
|
||||
|
||||
[node name="HideEyes" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
position = Vector2(8.125, -26.195)
|
||||
scale = Vector2(0.347656, 0.253906)
|
||||
texture = SubResource("GradientTexture2D_3wlsy")
|
||||
|
||||
[node name="ItemSprite" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
modulate = Color(0.164706, 0.898039, 0.984314, 1)
|
||||
position = Vector2(8.25, -27.32)
|
||||
scale = Vector2(0.403333, 0.403333)
|
||||
texture = ExtResource("3_yqrof")
|
||||
|
||||
[node name="Audio" type="Node2D" parent="."]
|
||||
|
||||
[node name="AudioStreamPlayer_dig" type="AudioStreamPlayer" parent="Audio"]
|
||||
|
||||
@ -2,7 +2,7 @@ extends CharacterBody2D
|
||||
class_name Player
|
||||
|
||||
const MAX_REACH = 100
|
||||
const HOLDING_ITEM_SPRITE_SIZE = 40.
|
||||
const HOLDING_ITEM_SPRITE_SIZE = 20.
|
||||
|
||||
signal player_updated(player: Player)
|
||||
signal upgraded
|
||||
@ -75,6 +75,7 @@ func _on_inventory_updated(_inventory: Inventory):
|
||||
1./(item_texture.get_width()/HOLDING_ITEM_SPRITE_SIZE),
|
||||
1./(item_texture.get_height()/HOLDING_ITEM_SPRITE_SIZE)
|
||||
)
|
||||
%HideEyes.visible = inventory.get_item() != null
|
||||
%ItemSprite.visible = inventory.get_item() != null
|
||||
emit_signal("player_updated", self)
|
||||
|
||||
@ -90,9 +91,14 @@ func calculate_direction():
|
||||
|
||||
velocity = input_direction * speed
|
||||
if input_direction.x:
|
||||
$Sprite.flip_h = (input_direction.x < 0)
|
||||
flip_character(input_direction.x > 0)
|
||||
|
||||
|
||||
func flip_character(face_right = true):
|
||||
$Sprite.flip_h = not face_right
|
||||
%ItemSprite.position.x = abs(%ItemSprite.position.x) * (1 if face_right else -1)
|
||||
%HideEyes.position.x = abs(%ItemSprite.position.x) * (1 if face_right else -1)
|
||||
|
||||
func can_interact(interactable : Interactable):
|
||||
return interactable.can_interact(self)
|
||||
|
||||
|
||||
@ -22,5 +22,10 @@ func _on_mouse_entered():
|
||||
func _on_mouse_excited():
|
||||
Pointer.stop_inspect_entity(self)
|
||||
|
||||
func inspected_text():
|
||||
return ""
|
||||
func pointer_text():
|
||||
return ""
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
pointer_text()
|
||||
)
|
||||
|
||||
@ -15,9 +15,15 @@ var planet : Planet # mis à jour par la classe Planet
|
||||
func _init(_planet = null):
|
||||
planet = _planet
|
||||
|
||||
func inspected_text():
|
||||
func pointer_text():
|
||||
return "Buried Loot"
|
||||
|
||||
func inspector_info() -> Inspector.Info:
|
||||
return Inspector.Info.new(
|
||||
"Buried Loot",
|
||||
"Can contain some seeds from the past... Dig it with a shovel."
|
||||
)
|
||||
|
||||
func generate_sprite() -> Node2D:
|
||||
var object = SPRITE_SCENE.instantiate()
|
||||
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
[gd_scene load_steps=30 format=3 uid="uid://12nak7amd1uq"]
|
||||
[gd_scene load_steps=25 format=3 uid="uid://12nak7amd1uq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/game/scripts/game_gui.gd" id="1_udau0"]
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="2_nq5i2"]
|
||||
[ext_resource type="Texture2D" uid="uid://cm3ehinvvj52i" path="res://gui/game/assets/texture/Interface sans boutons.png" id="3_n4kem"]
|
||||
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/game/assets/icons/bolt.svg" id="4_k4juk"]
|
||||
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="4_ujg5r"]
|
||||
[ext_resource type="Texture2D" uid="uid://c2pgaklnj5w3d" path="res://gui/game/assets/texture/Tablette info.png" id="6_fovlv"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="7_n4kem"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="8_n4kem"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3lff5fui1k0c" path="res://gui/game/inspector/inspector.tscn" id="6_dr1y2"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5cuxgisrsfgt" path="res://gui/game/pause/assets/icons/player-pause.svg" id="9_2wykm"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_id0t5"]
|
||||
@ -20,6 +18,21 @@ gradient = SubResource("Gradient_id0t5")
|
||||
fill_to = Vector2(1, 1)
|
||||
repeat = 1
|
||||
|
||||
[sub_resource type="Animation" id="Animation_l73to"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0.950568, 0, 0.346412, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_p6blc"]
|
||||
resource_name = "default"
|
||||
loop_mode = 1
|
||||
@ -36,38 +49,12 @@ tracks/0/keys = {
|
||||
"values": [Color(0.950568, 0, 0.346412, 1), Color(0.999996, 0.39403, 0.49625, 1), Color(0.950568, 0, 0.346412, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_l73to"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0.950568, 0, 0.346412, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_l3q4a"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_l73to"),
|
||||
&"default": SubResource("Animation_p6blc")
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ek73b"]
|
||||
atlas = ExtResource("7_n4kem")
|
||||
region = Rect2(76, 75, 124, 135)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_ek73b"]
|
||||
font = ExtResource("8_n4kem")
|
||||
font_size = 20
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_n4kem"]
|
||||
font_size = 12
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_2wykm"]
|
||||
offsets = PackedFloat32Array(0, 0.279476, 1)
|
||||
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1)
|
||||
@ -142,21 +129,6 @@ _data = {
|
||||
&"pass_day": SubResource("Animation_ykapk")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2wykm"]
|
||||
resource_name = "upgrade"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2, 0.9),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0.6, 0.580392, 0, 0), Color(0.600196, 0.581106, 0, 0.392157), Color(0.6, 0.580392, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_l3q4a"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
@ -172,12 +144,42 @@ tracks/0/keys = {
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2wykm"]
|
||||
resource_name = "upgrade"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2, 0.9),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0.6, 0.580392, 0, 0), Color(0.600196, 0.581106, 0, 0.392157), Color(0.6, 0.580392, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_nhqnj"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_l3q4a"),
|
||||
&"upgrade": SubResource("Animation_2wykm")
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_mbdxg"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("NoEnergyLeft:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -100)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_w16yr"]
|
||||
resource_name = "no_energy_left_appear"
|
||||
length = 0.5
|
||||
@ -194,21 +196,6 @@ tracks/0/keys = {
|
||||
"values": [Vector2(0, -100), Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_mbdxg"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("NoEnergyLeft:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -100)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_p0xoq"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_mbdxg"),
|
||||
@ -332,56 +319,10 @@ label_settings = ExtResource("4_ujg5r")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ItemInfo" type="TextureRect" parent="MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 300)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 8
|
||||
theme = ExtResource("2_nq5i2")
|
||||
texture = ExtResource("6_fovlv")
|
||||
expand_mode = 3
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/ItemInfo"]
|
||||
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 = 35
|
||||
theme_override_constants/margin_top = 35
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 75
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ItemInfo/MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_nq5i2")
|
||||
|
||||
[node name="ItemIcon" type="TextureRect" parent="MarginContainer/ItemInfo/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 50)
|
||||
layout_mode = 2
|
||||
texture = SubResource("AtlasTexture_ek73b")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="ItemName" type="Label" parent="MarginContainer/ItemInfo/MarginContainer/VBoxContainer"]
|
||||
[node name="Inspector" parent="MarginContainer" instance=ExtResource("6_dr1y2")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "fdqsd"
|
||||
label_settings = SubResource("LabelSettings_ek73b")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="ItemDesc" type="Label" parent="MarginContainer/ItemInfo/MarginContainer/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")
|
||||
autowrap_mode = 3
|
||||
clip_text = true
|
||||
size_flags_horizontal = 8
|
||||
|
||||
[node name="TopRightContent" type="HBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
69
gui/game/inspector/inspector.tscn
Normal file
69
gui/game/inspector/inspector.tscn
Normal file
@ -0,0 +1,69 @@
|
||||
[gd_scene load_steps=9 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="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="AtlasTexture" id="AtlasTexture_ek73b"]
|
||||
atlas = ExtResource("3_qfinp")
|
||||
region = Rect2(76, 75, 124, 135)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_ek73b"]
|
||||
font = ExtResource("4_yijvw")
|
||||
font_size = 20
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_n4kem"]
|
||||
font_size = 12
|
||||
|
||||
[node name="Inspector" type="TextureRect"]
|
||||
custom_minimum_size = Vector2(0, 300)
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 8
|
||||
theme = ExtResource("1_f5bv4")
|
||||
texture = ExtResource("2_a8c2j")
|
||||
expand_mode = 3
|
||||
stretch_mode = 4
|
||||
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"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_f5bv4")
|
||||
|
||||
[node name="Texture" type="TextureRect" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 50)
|
||||
layout_mode = 2
|
||||
texture = SubResource("AtlasTexture_ek73b")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Title" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "fdqsd dqsdq dsqdqsd"
|
||||
label_settings = SubResource("LabelSettings_ek73b")
|
||||
horizontal_alignment = 1
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="Desc" type="Label" parent="MarginContainer/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")
|
||||
autowrap_mode = 3
|
||||
clip_text = true
|
||||
35
gui/game/inspector/scripts/inspector.gd
Normal file
35
gui/game/inspector/scripts/inspector.gd
Normal file
@ -0,0 +1,35 @@
|
||||
extends Control
|
||||
class_name Inspector
|
||||
|
||||
var info : Info = null :
|
||||
set(i):
|
||||
info = i
|
||||
update_info(i)
|
||||
|
||||
func _ready():
|
||||
update_info(info)
|
||||
|
||||
func update_info(i : Info):
|
||||
if i == null:
|
||||
visible = false
|
||||
else :
|
||||
visible = true
|
||||
if i.texture:
|
||||
%Texture.texture = i.texture
|
||||
%Texture.visible = i.texture != null
|
||||
%Title.text = i.title
|
||||
%Desc.text = i.description
|
||||
|
||||
class Info:
|
||||
var title : String
|
||||
var texture: Texture
|
||||
var description : String
|
||||
|
||||
func _init(
|
||||
_title : String = "",
|
||||
_description : String = "",
|
||||
_texture : Texture = null,
|
||||
):
|
||||
title = _title
|
||||
description = _description
|
||||
texture = _texture
|
||||
1
gui/game/inspector/scripts/inspector.gd.uid
Normal file
1
gui/game/inspector/scripts/inspector.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://b36bjfq4sng36
|
||||
@ -3,19 +3,15 @@ class_name GameGui
|
||||
|
||||
signal pause_asked
|
||||
|
||||
func _ready():
|
||||
Pointer.connect("inspected_entity_changed", _on_inspected_entity_changed)
|
||||
|
||||
func _on_player_updated(player:Player):
|
||||
%EnergyCount.text = str(player.energy) + "/" + str(player.max_energy)
|
||||
%EnergyInfo.modulate = Color.WHITE if player.energy > 0 else Color.RED
|
||||
|
||||
update_no_energy_left_info(player.energy)
|
||||
|
||||
%ItemInfo.visible = player.inventory.get_item() != null
|
||||
if player.inventory.get_item():
|
||||
var item : Item = player.inventory.get_item()
|
||||
%ItemIcon.texture = item.icon
|
||||
%ItemName.text = item.name
|
||||
%ItemDesc.text = item.description
|
||||
|
||||
func _on_day_pass_pressed():
|
||||
|
||||
await $AnimationPlayer.animation_finished
|
||||
@ -44,6 +40,12 @@ func _on_planet_pass_day_started(planet):
|
||||
await $PassDayAnimation.animation_finished
|
||||
$PassDayAnimation.speed_scale = 1
|
||||
|
||||
func _on_inspected_entity_changed(e : InspectableEntity):
|
||||
var info : Inspector.Info = null
|
||||
if e:
|
||||
info = e.inspector_info()
|
||||
%Inspector.info = info
|
||||
|
||||
func update_no_energy_left_info(energy):
|
||||
if energy == 0 and not %NoEnergyLeft.visible:
|
||||
%NoEnergyLeft.visible = true
|
||||
|
||||
@ -1,11 +1,16 @@
|
||||
extends Node
|
||||
|
||||
signal inspected_entity_changed(e : InspectableEntity)
|
||||
|
||||
const DEFAULT_ACTION_COLOR = Color.WHITE
|
||||
const ENERGY_ACTION_COLOR = Color("ffff2b")
|
||||
|
||||
@export var default_cursor : Texture2D
|
||||
|
||||
var inspected_entity : InspectableEntity = null
|
||||
var inspected_entity : InspectableEntity = null :
|
||||
set(e):
|
||||
inspected_entity = e
|
||||
inspected_entity_changed.emit(e)
|
||||
var player : Player # renseigné par Player
|
||||
var can_interact : bool = false
|
||||
var current_selected_item : Item = null
|
||||
@ -72,7 +77,7 @@ func inspect_entity(entity : InspectableEntity):
|
||||
func update_inspector():
|
||||
%InspectorText.visible = inspected_entity != null
|
||||
if inspected_entity:
|
||||
%InspectorText.text = inspected_entity.inspected_text()
|
||||
%InspectorText.text = inspected_entity.pointer_text()
|
||||
|
||||
if player:
|
||||
if can_interact and inspected_entity and inspected_entity is Interactable:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user