Touches utilisant leur nom local + noms des touches dans le tuto + correction audio settings
This commit is contained in:
@@ -5,28 +5,36 @@ const STEP_SCENE = preload("res://gui/game/tutorial/step_gui/step_gui.tscn")
|
||||
|
||||
signal succeded
|
||||
|
||||
var indicators : Array[InGameIndicator]
|
||||
var player : Player
|
||||
var region : Region
|
||||
var game_gui : GameGui
|
||||
var indicators: Array[InGameIndicator]
|
||||
var player: Player
|
||||
var region: Region
|
||||
var game_gui: GameGui
|
||||
|
||||
var success = false
|
||||
|
||||
@onready var steps : Array[Step] = [
|
||||
@onready var steps: Array[Step] = [
|
||||
Step.new(
|
||||
"MOVE_WITH_RIGHT_CLICK_OR_WASD",
|
||||
(func ():
|
||||
tr("MOVE_WITH_RIGHT_CLICK_OR_WASD").format({
|
||||
"W": get_action_key_name("move_up"),
|
||||
"A": get_action_key_name("move_left"),
|
||||
"S": get_action_key_name("move_down"),
|
||||
"D": get_action_key_name("move_right")
|
||||
}),
|
||||
(func():
|
||||
return player.global_position.distance_to(region.data.player_spawn) > 30)
|
||||
),
|
||||
Step.new(
|
||||
"CHANGE_ZOOM_WITH_Z_X",
|
||||
(func ():
|
||||
tr("CHANGE_ZOOM_WITH_Z_X").format({
|
||||
"Z": get_action_key_name("zoom_in"),
|
||||
"X": get_action_key_name("zoom_out")
|
||||
}),
|
||||
(func():
|
||||
return GameInfo.settings_data.zoom != 1.),
|
||||
(func (): GameInfo.game_data.player_data.inventory.add_item(Detector.new()))
|
||||
(func(): GameInfo.game_data.player_data.inventory.add_item(Detector.new()))
|
||||
),
|
||||
Step.new(
|
||||
"SELECT_ITEM_WITH_SCROLL_CLICK_OR_NUMBER",
|
||||
(func ():
|
||||
(func():
|
||||
return player.data.inventory.current_item_ind != player.data.inventory.tools.size())
|
||||
),
|
||||
Step.new(
|
||||
@@ -36,14 +44,14 @@ var success = false
|
||||
),
|
||||
Step.new(
|
||||
"USE_YOUR_DETECTOR_TO_FIND_THE_BATTERY",
|
||||
(func ():
|
||||
(func():
|
||||
return player.position.distance_to(Vector2.ZERO) < 600)
|
||||
),
|
||||
Step.new(
|
||||
"RECHARGE_IN_THE_RECHARGE_STATION",
|
||||
(func ():
|
||||
(func():
|
||||
return region and region.data and not region.data.in_passing_day_animation and region.data.day != 1),
|
||||
(func ():
|
||||
(func():
|
||||
game_gui.show_energy()
|
||||
game_gui.show_help()
|
||||
game_gui.help.display_energy_tutorial()
|
||||
@@ -52,7 +60,7 @@ var success = false
|
||||
),
|
||||
Step.new(
|
||||
"DIG_A_TALION_VEIN_WITH_SHOVEL",
|
||||
(func ():
|
||||
(func():
|
||||
for e in region.entity_container.get_children():
|
||||
if e is ItemObject and e.item is Seed:
|
||||
return true
|
||||
@@ -60,21 +68,23 @@ var success = false
|
||||
),
|
||||
Step.new(
|
||||
"TAKE_A_SEED_BY_CLICKING_ON_IT",
|
||||
(func ():
|
||||
(func():
|
||||
return player.data.inventory.seeds.find_custom(
|
||||
func(i:Item): return i is Seed
|
||||
func(i: Item): return i is Seed
|
||||
) != -1)
|
||||
),
|
||||
Step.new(
|
||||
"DROP_SEED_WITH_KEY",
|
||||
(func ():
|
||||
tr("DROP_SEED_WITH_KEY").format({
|
||||
"Q": get_action_key_name("drop")
|
||||
}),
|
||||
(func():
|
||||
return (
|
||||
Input.is_action_pressed("drop"))
|
||||
)
|
||||
),
|
||||
Step.new(
|
||||
"PLANT_SEED_IN_FERTILE_ZONE",
|
||||
(func ():
|
||||
(func():
|
||||
for e in region.entity_container.get_children():
|
||||
if e is Plant:
|
||||
game_gui.help.display_plant_info_tutorial(e.card_info())
|
||||
@@ -83,13 +93,13 @@ var success = false
|
||||
),
|
||||
Step.new(
|
||||
"WAIT_FOR_THE_PLANT_MATURATION",
|
||||
(func ():
|
||||
(func():
|
||||
return region and region.data and not region.data.in_passing_day_animation and region.data.get_score() != 0),
|
||||
(func (): GameInfo.game_data.player_data.inventory.add_item(Fork.new()))
|
||||
(func(): GameInfo.game_data.player_data.inventory.add_item(Fork.new()))
|
||||
),
|
||||
Step.new(
|
||||
"HARVEST_A_MATURE_PLANT",
|
||||
(func ():
|
||||
(func():
|
||||
for e in region.entity_container.get_children():
|
||||
if e is Plant and e.harvested:
|
||||
return true
|
||||
@@ -97,20 +107,20 @@ var success = false
|
||||
),
|
||||
Step.new(
|
||||
"TAKE_HARVESTED_SEEDS",
|
||||
(func ():
|
||||
(func():
|
||||
for s in player.data.inventory.seeds:
|
||||
if s is Seed and len(s.plant_mutations) > 0:
|
||||
game_gui.help.display_mutations_tutorial(s.card_info())
|
||||
return true
|
||||
return false),
|
||||
(func ():
|
||||
(func():
|
||||
await game_gui.help.tutorial_passed
|
||||
game_gui.show_progress_bar()
|
||||
game_gui.help.display_plant_point_tutorial())
|
||||
),
|
||||
Step.new(
|
||||
"HAVE_3_PLANT_POINTS_SIMULTANEOUSLY",
|
||||
(func (): return region.data.get_score() >= 3)
|
||||
(func(): return region.data.get_score() >= 3)
|
||||
),
|
||||
]
|
||||
|
||||
@@ -141,7 +151,7 @@ func _process(_d):
|
||||
for i in len(steps):
|
||||
var step := steps[i]
|
||||
var step_gui := %Steps.get_children()[i] as TutorialStepGui
|
||||
step_gui.visible = i == 0 or steps[i-1].succeeded
|
||||
step_gui.visible = i == 0 or steps[i - 1].succeeded
|
||||
if step_gui.visible:
|
||||
var old_succeeded = step.succeeded
|
||||
step.update_succeeded()
|
||||
@@ -162,16 +172,15 @@ func finish_tutorial():
|
||||
SteamConnection.unlock_achievement(SteamConnection.ACH_FINISH_TUTORIAL)
|
||||
|
||||
class Step:
|
||||
|
||||
var text : String : get = get_text
|
||||
var is_step_over_callable : Callable
|
||||
var on_succeeded : Callable
|
||||
var text: String: get = get_text
|
||||
var is_step_over_callable: Callable
|
||||
var on_succeeded: Callable
|
||||
var succeeded = false
|
||||
|
||||
func _init(
|
||||
_text : String = "",
|
||||
_is_step_over_callable : Callable = (func():return false),
|
||||
_on_succeeded : Callable = (func():return false)
|
||||
_text: String = "",
|
||||
_is_step_over_callable: Callable = (func(): return false),
|
||||
_on_succeeded: Callable = (func(): return false)
|
||||
):
|
||||
text = _text
|
||||
is_step_over_callable = _is_step_over_callable
|
||||
@@ -186,3 +195,24 @@ class Step:
|
||||
if succeeded:
|
||||
on_succeeded.call()
|
||||
return succeeded
|
||||
|
||||
func get_action_key_name(action_name: String) -> String:
|
||||
var events: Array[InputEvent] = InputMap.action_get_events(action_name)
|
||||
|
||||
var saved_remapped_input = null
|
||||
var existing_remapped_id: int = GameInfo.settings_data.action_remapped.find(action_name)
|
||||
if existing_remapped_id != -1:
|
||||
saved_remapped_input = GameInfo.settings_data.input_remapped[existing_remapped_id]
|
||||
|
||||
var event: InputEvent = null
|
||||
if saved_remapped_input:
|
||||
event = saved_remapped_input
|
||||
else:
|
||||
event = null if events.size() == 0 else events[0]
|
||||
|
||||
var input_name: String = "UNASSIGNED" if event == null else event.as_text()
|
||||
if event is InputEventKey:
|
||||
var keycode = DisplayServer.keyboard_get_keycode_from_physical(event.physical_keycode)
|
||||
input_name = OS.get_keycode_string(keycode)
|
||||
|
||||
return input_name
|
||||
|
||||
Reference in New Issue
Block a user