- Rééquilibrage du mode histoire (vers le haut, le jeu sera un poil plus dur) - Ajout d'effet pour dissuader le joueur d'aller hors map (avec peut être un easter egg ???) - Réparation des noms de régions avec le mode twitch et ajout de nombreux noms de régions de la communauté - Buff de la mutation solide (plus qu'un jour de maturation en plus) - Quelques coquilles dans les textes (il doit en rester) - Ajout de la mention de la région choisie dans le dashboard du cockpit - Distributeurs plus clairs (surtout la notion de choix d'artefact)
141 lines
4.8 KiB
GDScript
141 lines
4.8 KiB
GDScript
extends CanvasLayer
|
|
class_name Announce
|
|
|
|
const DEFAULT_OBJECT_ACCELERATION = Vector2(3,0)
|
|
|
|
@export var announce_object : AnnounceObject = null : set = set_announce_object
|
|
|
|
# @export_tool_button("Update", "Callable") var update_action = set_announce_object
|
|
|
|
var announce_objects : Array[AnnounceObject] = []
|
|
|
|
var object_acceleration := Vector2(0,0)
|
|
|
|
var rotating := false
|
|
|
|
var prev_mouse_pos : Vector2
|
|
var next_mouse_pos : Vector2
|
|
|
|
const YELLOW_COLOR = Color("e29f32")
|
|
const RED_COLOR = Color("f20058")
|
|
|
|
func _ready():
|
|
set_announce_object()
|
|
%OkButton.button_down.connect(_on_ok_button_down)
|
|
hide()
|
|
|
|
|
|
GameInfo.game_data.player_data.inventory.tool_added.connect(
|
|
func (i : Item):
|
|
if not i.name in GameInfo.game_data.item_announced:
|
|
announce_objects.append(AnnounceTool.new(i, get_screenshots_for_item(i)))
|
|
GameInfo.game_data.item_announced.append(i.name)
|
|
)
|
|
|
|
var player_max_energy = GameInfo.game_data.progression_data.get_story_step().get_player_max_energy(
|
|
GameInfo.game_data.current_run.difficulty_setting
|
|
)
|
|
var player_max_inventory = GameInfo.game_data.progression_data.get_story_step().get_player_max_inventory(
|
|
GameInfo.game_data.current_run.difficulty_setting
|
|
)
|
|
|
|
if (
|
|
GameInfo.game_data.max_energy_announced != player_max_energy
|
|
):
|
|
if GameInfo.game_data.max_energy_announced < player_max_energy:
|
|
announce_objects.append(AnnounceModel.new(
|
|
tr("UPGRADED_MAX_ENERGY_TO_%d") % player_max_energy
|
|
))
|
|
GameInfo.game_data.max_energy_announced = player_max_energy
|
|
|
|
if (
|
|
GameInfo.game_data.max_inventory_announced != player_max_inventory
|
|
):
|
|
if GameInfo.game_data.max_inventory_announced < player_max_inventory:
|
|
announce_objects.append(AnnounceModel.new(
|
|
tr("UPGRADED_INVENTORY_SIZE_TO_%d") % player_max_inventory
|
|
))
|
|
GameInfo.game_data.max_inventory_announced = player_max_inventory
|
|
|
|
|
|
|
|
|
|
|
|
func _process(delta):
|
|
if GameInfo.game_data.progression_data is InfiniteProgressionData:
|
|
return
|
|
|
|
if announce_object == null and not visible and len(announce_objects) > 0:
|
|
announce_object = announce_objects.pop_front()
|
|
update_rotation(delta)
|
|
|
|
func get_screenshots_for_item(i : Item) -> Texture:
|
|
if i is Pickaxe:
|
|
return preload("res://gui/game/announce/screenshots/pickaxe.png")
|
|
if i is Detector:
|
|
return preload("res://gui/game/announce/screenshots/detector.png")
|
|
if i is Fork:
|
|
return preload("res://gui/game/announce/screenshots/fork.png")
|
|
return null
|
|
|
|
func update_rotation(delta):
|
|
if visible:
|
|
next_mouse_pos = get_viewport().get_mouse_position()
|
|
if Input.is_action_just_pressed("action"):
|
|
rotating = true
|
|
prev_mouse_pos = get_viewport().get_mouse_position()
|
|
if Input.is_action_just_released("action"):
|
|
rotating = false
|
|
object_acceleration = Vector2(
|
|
float(next_mouse_pos.x - prev_mouse_pos.x),
|
|
float(next_mouse_pos.y - prev_mouse_pos.y)
|
|
)
|
|
|
|
var object_rotation = object_acceleration
|
|
|
|
if rotating:
|
|
object_rotation = Vector2(
|
|
float(next_mouse_pos.x - prev_mouse_pos.x),
|
|
float(next_mouse_pos.y - prev_mouse_pos.y)
|
|
)
|
|
prev_mouse_pos = next_mouse_pos
|
|
else :
|
|
object_acceleration = object_acceleration.lerp(DEFAULT_OBJECT_ACCELERATION, 0.1)
|
|
|
|
%AnnounceObject.rotate(Vector3.UP, object_rotation.x * delta)
|
|
%AnnounceObject.rotate(Vector3.RIGHT, object_rotation.y * delta)
|
|
|
|
|
|
func set_announce_object(object := announce_object):
|
|
Pointer.action_disabled = not object
|
|
if is_node_ready() and object:
|
|
for children in %AnnounceObject.get_children():
|
|
children.queue_free()
|
|
|
|
%Camera3D.position.z = object.get_camera_z_pos()
|
|
|
|
%AnnounceObject.add_child(object.get_3d_object())
|
|
%AnnounceObject.rotation = Vector3.ZERO
|
|
%AnnounceTitle.text = object.get_title()
|
|
%AnnounceText.text = object.get_text()
|
|
%AnnounceDesc.text = object.get_desc()
|
|
%AnnounceImage.texture = object.get_image()
|
|
%ObjectVisualiser.info = object.get_card_info()
|
|
|
|
if not visible:
|
|
%AnimationPlayer.play("appear")
|
|
Pointer.action_disabled = true
|
|
AudioManager.play_sfx("Unlock_tool")
|
|
elif object == null and visible:
|
|
%AnimationPlayer.play_backwards("appear")
|
|
get_tree().create_timer(0.2).timeout.connect( # Put a delay to not interfere with the ok button click
|
|
func():
|
|
Pointer.action_disabled = false
|
|
)
|
|
announce_object = object
|
|
|
|
func _on_ok_button_down():
|
|
if announce_object:
|
|
announce_object._on_dismiss()
|
|
announce_object = null
|