ajout de la traduction #70

* Fix de l'inspection de l'inventaire
* Suppression des assets d'objectifs
This commit is contained in:
2025-11-07 17:36:18 +01:00
parent ed675ed532
commit a8bb09407e
91 changed files with 485 additions and 872 deletions

View File

@@ -8,29 +8,27 @@ signal item_clicked()
const MODULATE_INSPECTED_COLOR = Color.GRAY
var current_item : Item = null
var item : Item = null
var was_selected : bool = false
func _ready():
mouse_entered.connect(_on_mouse_entered)
mouse_exited.connect(_on_mouse_excited)
mouse_entered.connect(
func(): Pointer.inspect(self)
)
mouse_exited.connect(
func(): Pointer.stop_inspect(self)
)
update(null, false)
func inspect(is_inspected : bool = true):
modulate = MODULATE_INSPECTED_COLOR if is_inspected else Color.WHITE
func _on_mouse_entered():
if current_item:
Pointer.inspect(self)
func _on_mouse_excited():
if current_item:
Pointer.stop_inspect(self)
func _on_gui_input(_event: InputEvent) -> void:
if Input.is_action_just_pressed("action"):
emit_signal("item_clicked")
func update(item: Item, selected : bool):
func update(_item: Item, selected : bool):
item = _item
if selected and not was_selected:
%SelectedAnimation.play("selected")
elif not selected and was_selected:

View File

@@ -120,37 +120,19 @@ alignment = 1
[node name="PauseTitle" type="Label" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
text = "Pause"
text = "PAUSE"
label_settings = SubResource("LabelSettings_apjlw")
horizontal_alignment = 1
[node name="StoryTitle" type="Label" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
text = "Story"
label_settings = ExtResource("3_0pdto")
horizontal_alignment = 1
[node name="StoryText" type="Label" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
text = "You are a robot who has recently arrived on a barren planet. Find and plant seeds to reduce the contamination.
You have limited energy, but can recharge when passing days.
Each 7 days, you have to meet a quota of decontaminted lands.
You get a machine to build each quota reached."
horizontal_alignment = 1
[node name="ControlsTitle" type="Label" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
text = "Controls"
text = "CONTROLS"
label_settings = ExtResource("3_0pdto")
horizontal_alignment = 1
[node name="ControlsText" type="Label" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
text = "Directional Arrows/Right Click : Move
Left Click : Interact/Pickup Items
Mouse Wheel : Change current item
X : Drop Item
"
text = "CONTROLS_TEXT"
horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="Container/Tutorial/VBoxContainer"]
@@ -159,17 +141,17 @@ alignment = 1
[node name="Resume" type="Button" parent="Container/Tutorial/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Resume Game"
text = "RESUME_GAME"
icon = ExtResource("5_apjlw")
[node name="Restart" type="Button" parent="Container/Tutorial/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Restart"
text = "RESTART"
icon = ExtResource("6_58dya")
[node name="Quit" type="Button" parent="Container/Tutorial/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Quit"
text = "QUIT"
icon = ExtResource("7_yj6f1")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]

View File

@@ -2,6 +2,8 @@ extends CanvasLayer
var pause = false : set = set_pause
const PLANET_RUN_SCENE = preload("res://stages/planet_run/planet_run.tscn")
func set_pause(p):
if p != pause:
if p:
@@ -22,7 +24,7 @@ func _on_resume_pressed():
func _on_restart_pressed():
GameInfo.game_data.reset_all()
pause = false
get_tree().reload_current_scene()
get_tree().change_scene_to_packed(PLANET_RUN_SCENE)
func _on_quit_pressed():
get_tree().quit()

View File

@@ -92,8 +92,8 @@ class DiscoverPlantReward extends RewardData:
func reward_info() -> QuotaRewardChoiceInfo:
var info = QuotaRewardChoiceInfo.new()
info.title = "Discover %s" % new_plant_type.name
info.text = "%s seeds can now be found" % new_plant_type.name
info.title = tr("DISCOVER_%s") % new_plant_type.name
info.text = tr("%s_SEEDS_CAN_NOW_BE_FOUND") % new_plant_type.name
info.card_info = new_plant_type.card_info()
return info
@@ -110,7 +110,7 @@ class EvolvePlantReward extends RewardData:
func reward_info() -> QuotaRewardChoiceInfo:
var info = QuotaRewardChoiceInfo.new()
info.title = "Evolve %s" % plant_evolution.plant_type.name
info.title = tr("EVOLVE_%s") % plant_evolution.plant_type.name
info.text = plant_evolution.get_description()
var preview_evolved_plant = plant_evolution.plant_type.duplicate_deep()
plant_evolution.evolve(preview_evolved_plant)

View File

@@ -39,7 +39,7 @@ func _on_planet_updated(planet_data : PlanetData):
func planet_update(planet_data : PlanetData):
if planet_data:
%DayCount.text = "%d days left" % (planet_data.quota_days)
%DayCount.text = tr("%d_DAY_LEFT") % (planet_data.quota_days)
var quota_progression_percent : float = (float(planet_data.garden_score) / float(planet_data.get_quota_score())) * 100
%QuotaProgressText.text = "%d/%d" % [planet_data.garden_score, planet_data.get_quota_score()]
@@ -83,14 +83,14 @@ func _on_planet_new_quota_started(planet_data : PlanetData):
func announce_quota(planet_data : PlanetData):
%Announce.announce(
"New Quota",
"Reach %d garden score before %d days" % [planet_data.get_quota_score(), planet_data.get_quota_duration()]
tr("NEW_QUOTA"),
tr("REACH_%d_GARDEN_SCORE_BEFORE_%d_DAYS") % [planet_data.get_quota_score(), planet_data.get_quota_duration()]
)
func _on_planet_pass_day_ended(planet:Planet):
if planet.data.quota_days == 1:
%Announce.announce(
"Last day for reaching quota",
tr("LAST_DAY_FOR_REACHING_QUOTA"),
str(roundi(planet.data.get_quota_score() - planet.garden.get_score())) + " garden score left",
Announce.RED_COLOR
)

View File

@@ -61,7 +61,7 @@ class TakeShovelStep extends Step:
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
for entity in planet.entity_container.get_children():
if entity is ItemObject and entity.item is Shovel:
var indicator = generate_indicator("Take the Shovel")
var indicator = generate_indicator(tr("TAKE_THE_SHOVEL"))
indicator.follow_entity(entity)
return [
indicator
@@ -88,7 +88,7 @@ class DigLootStep extends Step:
closest_loot = entity
if closest_loot:
var indicator = generate_indicator("Dig Underground Loot")
var indicator = generate_indicator(tr("DIG_UNDERGROUND_LOOT"))
indicator.follow_entity(closest_loot)
return [indicator]
return []
@@ -104,7 +104,7 @@ class TakeSeedStep extends Step:
var indicators : Array[InGameIndicator] = []
for entity in planet.entity_container.get_children():
if entity is ItemObject and entity.item is Seed:
var indicator = generate_indicator("Take a seed")
var indicator = generate_indicator(tr("TAKE_A_SEED"))
indicator.follow_entity(entity)
indicators.append(
indicator
@@ -119,7 +119,7 @@ class TakeSeedStep extends Step:
class PlantSeedStep extends Step:
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
var indicator = generate_indicator("Plant the seed in decontamined zone")
var indicator = generate_indicator(tr("PLANT_THE_SEED_IN_DECONTAMINED_ZONE"))
indicator.follow_game_position(Vector2(0,0) + planet.entity_container.global_position)
return [indicator]
@@ -132,7 +132,7 @@ class PlantSeedStep extends Step:
class RechargeStep extends Step:
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
for entity in planet.entity_container.get_children():
var indicator = generate_indicator("Recharge to pass days")
var indicator = generate_indicator(tr("RECHARGE_TO_PASS_DAYS"))
indicator.follow_entity(entity)
if entity is TruckRecharge:
return [
@@ -166,7 +166,7 @@ class HarvestMaturePlant extends Step:
var indicators : Array[InGameIndicator] = []
for entity in planet.entity_container.get_children():
if entity is Plant and entity.state == Plant.State.MATURE:
var indicator = generate_indicator("Harvest mature plants with shovel")
var indicator = generate_indicator(tr("HARVEST_MATURE_PLANTS_WITH_SHOVEL"))
indicator.follow_entity(entity)
indicators.append(
indicator

View File

@@ -1,17 +1,19 @@
extends Control
const PLANET_RUN_SCENE = preload("res://stages/planet_run/planet_run.tscn")
func _ready():
visible = false
func win(planet : Planet):
visible = true
get_tree().paused = true
%WinTitle.text = "Score : " + str(roundi(planet.garden.get_score()))
%WinTitle.text = tr("SCORE_%d") % str(roundi(planet.garden.get_score()))
func _on_restart_pressed():
GameInfo.game_data.reset_all()
get_tree().paused = false
get_tree().reload_current_scene()
get_tree().change_scene_to_packed(PLANET_RUN_SCENE)
func _on_quit_pressed():
get_tree().quit()

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://0yr6b2jtuttm"]
[gd_scene load_steps=15 format=3 uid="uid://0yr6b2jtuttm"]
[ext_resource type="Script" uid="uid://vhumsfntpqcl" path="res://gui/pointer/scripts/pointer.gd" id="1_1pe2k"]
[ext_resource type="Texture2D" uid="uid://bspffyprdywgc" path="res://gui/pointer/assets/cursors/pointer.svg" id="2_q4bvb"]
@@ -13,17 +13,14 @@
[ext_resource type="Script" uid="uid://b4tkium34c831" path="res://gui/game/card/scripts/card_stat_info.gd" id="10_d4v46"]
[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="11_s1ym6"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_s1ym6"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_6eft6"]
shader = ExtResource("7_wgcdp")
shader_parameter/fov = 90.0
shader_parameter/cull_back = true
shader_parameter/y_rot = 8.409235e-36
shader_parameter/x_rot = -9.785961e-36
shader_parameter/y_rot = -6e-45
shader_parameter/x_rot = -6e-45
shader_parameter/inset = 0.0
[sub_resource type="ViewportTexture" id="ViewportTexture_xb313"]
viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_mrxa2"]
script = ExtResource("8_xb313")
metadata/_custom_type_script = "uid://dj2pv1hiwjfv0"
@@ -46,8 +43,8 @@ mouse_filter = 2
[node name="Container" type="VBoxContainer" parent="CanvasLayer/Inspector"]
layout_mode = 0
offset_left = 40.0
offset_right = 137.0
offset_left = 28.0
offset_right = 134.0
offset_bottom = 79.0
size_flags_horizontal = 0
size_flags_vertical = 0
@@ -55,26 +52,30 @@ mouse_filter = 2
[node name="Action" type="HBoxContainer" parent="CanvasLayer/Inspector/Container"]
unique_name_in_owner = true
modulate = Color(1, 1, 0.168627, 1)
custom_minimum_size = Vector2(0, 20)
layout_mode = 2
[node name="MouseImage" type="TextureRect" parent="CanvasLayer/Inspector/Container/Action"]
layout_mode = 2
texture = ExtResource("3_pshoq")
expand_mode = 2
stretch_mode = 5
[node name="ActionEnergyImage" type="TextureRect" parent="CanvasLayer/Inspector/Container/Action"]
unique_name_in_owner = true
layout_mode = 2
texture = ExtResource("4_b4uwv")
expand_mode = 2
stretch_mode = 5
[node name="ActionText" type="Label" parent="CanvasLayer/Inspector/Container/Action"]
[node name="ActionText" type="RichTextLabel" parent="CanvasLayer/Inspector/Container/Action"]
unique_name_in_owner = true
z_index = 1
layout_mode = 2
text = "Take"
horizontal_alignment = 1
bbcode_enabled = true
text = "Hello ?"
fit_content = true
scroll_active = false
autowrap_mode = 0
[node name="ActionZone" type="Sprite2D" parent="CanvasLayer/Inspector"]
unique_name_in_owner = true
@@ -111,16 +112,18 @@ offset_right = 175.0
grow_horizontal = 2
grow_vertical = 0
mouse_filter = 2
theme_override_constants/margin_bottom = 30
theme_override_constants/margin_left = 0
theme_override_constants/margin_top = 0
theme_override_constants/margin_right = 0
theme_override_constants/margin_bottom = 0
[node name="CardVisualiser" parent="CardsCanvasLayer/CardPosition/MarginContainer" instance=ExtResource("6_7j4mj")]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0.5003133)
material = SubResource("ShaderMaterial_s1ym6")
material = SubResource("ShaderMaterial_6eft6")
layout_mode = 2
size_flags_horizontal = 4
mouse_filter = 0
texture = SubResource("ViewportTexture_xb313")
card_info = SubResource("Resource_mrxa2")
[node name="Audio" type="Node" parent="."]

View File

@@ -8,6 +8,7 @@ const ZONE_ACTIVATED_COLOR = Color.TURQUOISE
const ZONE_DEACTIVATED_COLOR = Color.REBECCA_PURPLE
const CARD_VISUALISATION_TIME = 0.5
const CARD_UP_PADDING = 20
@export var default_cursor : Texture2D
@@ -90,16 +91,23 @@ func inspect(node : Node):
inspected = node
if inspected is InspectableEntity:
inspected_card_info = inspected.card_info()
elif inspected is InventoryGuiItem and inspected.item != null:
inspected_card_info = inspected.item.card_info()
else :
inspected_card_info = null
time_last_inspected = 0
if current_inspect.has_method("inspect"):
current_inspect.inspect(true)
update_inspector()
func update_card():
if not inspected or time_last_inspected > CARD_VISUALISATION_TIME:
if not inspected or inspected_card_info == null or time_last_inspected > CARD_VISUALISATION_TIME:
%CardVisualiser.hide()
elif inspected != null and inspected is InspectableEntity:
elif inspected != null and (
inspected is InspectableEntity
or inspected is InventoryGuiItem
):
if inspected_card_info != %CardVisualiser.card_info:
%CardVisualiser.card_info = inspected_card_info
@@ -107,7 +115,10 @@ func update_card():
var camera = get_viewport().get_camera_2d()
var screen_size = get_viewport().get_visible_rect().size
%CardPosition.position = inspected.global_position - camera.global_position + screen_size / 2
if inspected is InspectableEntity:
%CardPosition.position = inspected.global_position - camera.global_position + screen_size / 2 + CARD_UP_PADDING * Vector2.UP
elif inspected is InventoryGuiItem:
%CardPosition.position = inspected.global_position + inspected.size/2 + CARD_UP_PADDING * Vector2.UP
if %CardVisualiser.is_mouse_over():
time_last_inspected = 0.