more work on the ui theme and changing the hud
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
class_name AudioOptionsMenu
|
||||
extends VBoxContainer
|
||||
|
||||
@export var master_input: SpinBox
|
||||
@export var master_slider: HSlider
|
||||
@export var music_input: SpinBox
|
||||
@export var music_slider: HSlider
|
||||
@export var sfx_input: SpinBox
|
||||
@export var sfx_slider: HSlider
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
master_input.value = Data.audio.master
|
||||
master_slider.value = Data.audio.master
|
||||
music_input.value = Data.audio.music
|
||||
music_slider.value = Data.audio.music
|
||||
sfx_input.value = Data.audio.sfx
|
||||
sfx_slider.value = Data.audio.sfx
|
||||
|
||||
|
||||
func _on_master_spin_box_value_changed(value: float) -> void:
|
||||
master_slider.value = value
|
||||
Data.audio.master = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_master_h_slider_value_changed(value: float) -> void:
|
||||
master_input.value = value
|
||||
Data.audio.master = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_music_spin_box_value_changed(value: float) -> void:
|
||||
music_slider.value = value
|
||||
Data.audio.music = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_music_h_slider_value_changed(value: float) -> void:
|
||||
music_input.value = value
|
||||
Data.audio.music = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_sfx_spin_box_value_changed(value: float) -> void:
|
||||
sfx_slider.value = value
|
||||
Data.audio.sfx = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_sfx_h_slider_value_changed(value: float) -> void:
|
||||
sfx_input.value = value
|
||||
Data.audio.sfx = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), linear_to_db(value / 100.0))
|
||||
@@ -1 +0,0 @@
|
||||
uid://c4ljvgrb81du6
|
||||
@@ -4,9 +4,9 @@ extends PanelContainer
|
||||
signal completed(outcome: bool)
|
||||
|
||||
func set_popup(prompt_text: String, confirm_text: String, cancel_text: String) -> void:
|
||||
$VBoxContainer/Label.text = prompt_text
|
||||
$VBoxContainer/HBoxContainer/Confirm.text = confirm_text
|
||||
$VBoxContainer/HBoxContainer/Cancel.text = cancel_text
|
||||
$VBoxContainer/Label.text = tr(prompt_text)
|
||||
$VBoxContainer/HBoxContainer/Confirm.text = tr(confirm_text)
|
||||
$VBoxContainer/HBoxContainer/Cancel.text = tr(cancel_text)
|
||||
|
||||
|
||||
func _on_confirm_pressed() -> void:
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
class_name DamageParticle
|
||||
extends Sprite3D
|
||||
|
||||
@onready var label: Label = $SubViewport/Label
|
||||
var time_alive: float = 0.0
|
||||
var movement_speed: float = 1.0
|
||||
var movement_vector: Vector3
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var theta: float = deg_to_rad(40)
|
||||
var z: float = randf_range(cos(theta), 1)
|
||||
var phi: float = randf_range(0, 2 * PI)
|
||||
var vector: Vector3 = Vector3(sqrt(1 - pow(z, 2)) * cos(phi), z, sqrt(1 - pow(z, 2)) * sin(phi))
|
||||
movement_vector = vector.normalized()
|
||||
|
||||
|
||||
func set_number(num: int) -> void:
|
||||
label.text = str(num)
|
||||
|
||||
|
||||
func set_color(color: Color) -> void:
|
||||
label.modulate = color
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
time_alive += delta
|
||||
position += movement_vector * movement_speed * delta
|
||||
if time_alive >= 1.0:
|
||||
queue_free()
|
||||
@@ -1 +0,0 @@
|
||||
uid://blt7umrgo3tfh
|
||||
@@ -168,7 +168,7 @@ func set_upcoming_wave() -> void:
|
||||
|
||||
func temp_set_upcoming_wave(new_wave: Wave, coins: int) -> void:
|
||||
pot = coins
|
||||
connected_players_nodes[multiplayer.get_unique_id()].hud.show_wave_generation_anim(new_wave)
|
||||
#connected_players_nodes[multiplayer.get_unique_id()].hud.show_wave_generation_anim(new_wave)
|
||||
connected_players_nodes[multiplayer.get_unique_id()].hud.set_upcoming_wave(new_wave.to_dict())
|
||||
|
||||
#TODO: You'll probably have to write a to_dict function for the new wave system
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
class_name GameplayOptionsMenu
|
||||
extends VBoxContainer
|
||||
|
||||
@export var look_sens_slider: HSlider
|
||||
@export var look_sens_input: SpinBox
|
||||
@export var toggle_sprint_checkbox: CheckButton
|
||||
@export var invert_lookY: CheckButton
|
||||
@export var invert_lookX: CheckButton
|
||||
@export var fixed_minimap: CheckButton
|
||||
@export var tower_damage: Button
|
||||
@export var self_damage: Button
|
||||
@export var party_damage: Button
|
||||
@export var status_damage: Button
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
look_sens_slider.value = Data.preferences.mouse_sens
|
||||
look_sens_input.value = Data.preferences.mouse_sens
|
||||
toggle_sprint_checkbox.button_pressed = Data.preferences.toggle_sprint
|
||||
invert_lookY.button_pressed = Data.preferences.invert_lookY
|
||||
invert_lookX.button_pressed = Data.preferences.invert_lookX
|
||||
fixed_minimap.button_pressed = Data.preferences.fixed_minimap
|
||||
tower_damage.button_pressed = Data.preferences.display_tower_damage_indicators
|
||||
self_damage.button_pressed = Data.preferences.display_self_damage_indicators
|
||||
party_damage.button_pressed = Data.preferences.display_party_damage_indicators
|
||||
status_damage.button_pressed = Data.preferences.display_status_effect_damage_indicators
|
||||
|
||||
|
||||
func save() -> void:
|
||||
Data.preferences.mouse_sens = look_sens_slider.value
|
||||
Data.preferences.toggle_sprint = toggle_sprint_checkbox.button_pressed
|
||||
Data.preferences.invert_lookY = invert_lookY.button_pressed
|
||||
Data.preferences.invert_lookX = invert_lookX.button_pressed
|
||||
Data.preferences.fixed_minimap = fixed_minimap.button_pressed
|
||||
Data.preferences.display_tower_damage_indicators = tower_damage.button_pressed
|
||||
Data.preferences.display_self_damage_indicators = self_damage.button_pressed
|
||||
Data.preferences.display_party_damage_indicators = party_damage.button_pressed
|
||||
Data.preferences.display_status_effect_damage_indicators = status_damage.button_pressed
|
||||
|
||||
|
||||
func _on_mouse_sens_spin_box_value_changed(value: float) -> void:
|
||||
look_sens_slider.value = value
|
||||
|
||||
|
||||
func _on_mouse_sens_h_slider_value_changed(value: float) -> void:
|
||||
look_sens_input.value = value
|
||||
@@ -1 +0,0 @@
|
||||
uid://dtrjph756oq1f
|
||||
@@ -1,36 +0,0 @@
|
||||
class_name GraphicsOptionsMenu
|
||||
extends VBoxContainer
|
||||
|
||||
@export var fov_input: SpinBox
|
||||
@export var fov_slider: HSlider
|
||||
@export var vsync_dropdown: OptionButton
|
||||
@export var aa_dropdown: OptionButton
|
||||
@export var window_dropdown: OptionButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
fov_input.value = Data.graphics.hfov
|
||||
fov_slider.value = Data.graphics.hfov
|
||||
vsync_dropdown.selected = Data.graphics.vsync_mode
|
||||
aa_dropdown.selected = Data.graphics.aa_mode
|
||||
|
||||
|
||||
func save() -> void:
|
||||
Data.graphics.hfov = fov_slider.value
|
||||
Data.graphics.vsync_mode = vsync_dropdown.selected
|
||||
Data.graphics.aa_mode = aa_dropdown.selected
|
||||
Data.graphics.windowed_mode = window_dropdown.selected
|
||||
|
||||
|
||||
func _on_fov_spin_box_value_changed(value: float) -> void:
|
||||
if value < 40.0:
|
||||
value = 40.0
|
||||
if value > 160.0:
|
||||
value = 160.0
|
||||
fov_slider.value = value
|
||||
Data.graphics.hfov = value
|
||||
|
||||
|
||||
func _on_fov_h_slider_value_changed(value: float) -> void:
|
||||
fov_input.value = value
|
||||
Data.graphics.hfov = value
|
||||
@@ -1 +0,0 @@
|
||||
uid://bpb5c5r1yi8um
|
||||
@@ -1,28 +0,0 @@
|
||||
class_name HealthBar
|
||||
extends TextureProgressBar
|
||||
|
||||
@export var health_bar_gradient: Gradient
|
||||
|
||||
@onready var prev_bar: TextureProgressBar = $PreviousHealthBar
|
||||
|
||||
|
||||
func setup(health: float) -> void:
|
||||
max_value = health
|
||||
value = health
|
||||
prev_bar.max_value = health
|
||||
prev_bar.value = health
|
||||
|
||||
|
||||
func on_health_changed(health: float) -> void:
|
||||
set_visible(true)
|
||||
var health_went_down: bool = true if health < value else false
|
||||
value = health
|
||||
tint_progress = health_bar_gradient.sample(value / max_value)
|
||||
if health_went_down:
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_QUINT)
|
||||
tween.tween_interval(0.3)
|
||||
tween.tween_property(prev_bar, "value", value, 0.7)
|
||||
else:
|
||||
prev_bar.value = value
|
||||
@@ -1 +0,0 @@
|
||||
uid://bf06es50d0flv
|
||||
@@ -1,53 +0,0 @@
|
||||
extends VBoxContainer
|
||||
class_name KeybindsOptionsMenu
|
||||
|
||||
var keybind_entry_scene: PackedScene = load("res://Scenes/UI/keybind_entry.tscn")
|
||||
var keybind_popup: PackedScene = load("res://Scenes/UI/keybind_popup.tscn")
|
||||
var keybind_boxes: Array[KeybindEntry] = []
|
||||
var key_event: InputEvent
|
||||
var selected_entry: KeybindEntry
|
||||
var listening_for_key: bool = false
|
||||
var ui_layer: CanvasLayer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
#for index: int in Data.keymaps.size():
|
||||
# var map: PlayerKeymap = Data.keymaps[index]
|
||||
# var button: Button = Button.new()
|
||||
# button.text = map.title
|
||||
# button.pressed.connect(set_keymap.bind(index))
|
||||
# $HBoxContainer.add_child(button)
|
||||
load_keybind_labels()
|
||||
|
||||
|
||||
func set_keymap(keymap_index: int) -> void:
|
||||
Data.player_keymap = Data.keymaps[keymap_index]
|
||||
Data.player_keymap.apply()
|
||||
load_keybind_labels()
|
||||
|
||||
|
||||
func load_keybind_labels() -> void:
|
||||
for box: KeybindEntry in keybind_boxes:
|
||||
box.queue_free()
|
||||
keybind_boxes.clear()
|
||||
for action: StringName in InputMap.get_actions():
|
||||
if !action.begins_with("ui_"):
|
||||
var entry: KeybindEntry = keybind_entry_scene.instantiate() as KeybindEntry
|
||||
entry.set_action_name(action)
|
||||
if InputMap.action_get_events(action).size() > 0:
|
||||
for event: InputEvent in InputMap.action_get_events(action):
|
||||
entry.add_bind_button(event)
|
||||
keybind_boxes.append(entry)
|
||||
entry.bind_button_pressed.connect(_on_keybind_button_pressed.bind(entry))
|
||||
$ScrollContainer/VBoxContainer.add_child(entry)
|
||||
|
||||
|
||||
func _on_keybind_button_pressed(button: Button, keybind_entry: KeybindEntry) -> void:
|
||||
var popup: KeybindPopup = keybind_popup.instantiate()
|
||||
popup.event_detected.connect(keybind_entry.set_button_bind.bind(button))
|
||||
ui_layer.add_child(popup)
|
||||
|
||||
|
||||
func save() -> void:
|
||||
for entry: KeybindEntry in keybind_boxes:
|
||||
Data.keymap_data.add_binding(entry.to_array())
|
||||
@@ -1 +0,0 @@
|
||||
uid://cxm67e833baex
|
||||
@@ -1,69 +0,0 @@
|
||||
class_name KeymapData
|
||||
extends RefCounted
|
||||
|
||||
var title: String = "default"
|
||||
var map: Dictionary[String, Array]
|
||||
|
||||
|
||||
func add_binding(bind_array: Array) -> void:
|
||||
var x: int = bind_array.size() - 1
|
||||
var arr: Array
|
||||
for i: int in x:
|
||||
arr.append(bind_array[i + 1])
|
||||
map[bind_array[0][0]] = arr
|
||||
|
||||
|
||||
static func event_from_array(array: Array) -> InputEvent:
|
||||
if array.size() < 2:
|
||||
return null
|
||||
if array[0] == "InputEventKey":
|
||||
var event: InputEventKey = InputEventKey.new()
|
||||
event.physical_keycode = array[1]
|
||||
return event
|
||||
if array[0] == "InputEventMouseButton":
|
||||
var event: InputEventMouseButton = InputEventMouseButton.new()
|
||||
event.button_index = array[1]
|
||||
return event
|
||||
if array[0] == "InputEventJoypadButton":
|
||||
var event: InputEventJoypadButton = InputEventJoypadButton.new()
|
||||
event.button_index = array[1]
|
||||
return event
|
||||
return null
|
||||
|
||||
|
||||
func apply() -> void:
|
||||
for action_string: String in map.keys():
|
||||
InputMap.action_erase_events(action_string)
|
||||
for binding: Array in map[action_string]:
|
||||
var event: InputEvent = event_from_array(binding)
|
||||
if event:
|
||||
InputMap.action_add_event(action_string, event)
|
||||
|
||||
|
||||
func save_to_disc() -> void:
|
||||
var dir: DirAccess = DirAccess.open("user://")
|
||||
if !dir.dir_exists("keymaps"):
|
||||
dir.make_dir("keymaps")
|
||||
var save_file: FileAccess = FileAccess.open("user://keymaps/default", FileAccess.WRITE)
|
||||
var dict: Dictionary = {
|
||||
"title" = title,
|
||||
"map" = map,
|
||||
}
|
||||
var json_string: String = JSON.stringify(dict)
|
||||
save_file.store_line(json_string)
|
||||
|
||||
|
||||
static func load_from_disk() -> KeymapData:
|
||||
if FileAccess.file_exists("user://keymaps/default"):
|
||||
var save_file: FileAccess = FileAccess.open("user://keymaps/default", FileAccess.READ)
|
||||
var json_string: String = save_file.get_line()
|
||||
var json: JSON = JSON.new()
|
||||
var parse_result: Error = json.parse(json_string)
|
||||
if parse_result == OK:
|
||||
var dict: Dictionary = json.data
|
||||
var keymap: KeymapData = KeymapData.new()
|
||||
keymap.title = dict["title"]
|
||||
for key: String in dict["map"].keys():
|
||||
keymap.map[key] = dict["map"][key]
|
||||
return keymap
|
||||
return KeymapData.new()
|
||||
@@ -1 +0,0 @@
|
||||
uid://dui1k2e4q6cl
|
||||
@@ -1,44 +0,0 @@
|
||||
class_name OptionsMenu
|
||||
extends Control
|
||||
|
||||
@export var gameplay: GameplayOptionsMenu
|
||||
@export var graphics: GraphicsOptionsMenu
|
||||
@export var keybinds: KeybindsOptionsMenu
|
||||
@export var audio: AudioOptionsMenu
|
||||
var game_manager: GameManager
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
set_tab_locale()
|
||||
keybinds.ui_layer = game_manager.UILayer
|
||||
|
||||
|
||||
func set_tab_locale() -> void:
|
||||
gameplay.name = tr("OPTIONS_TAB_GAMEPLAY")
|
||||
graphics.name = tr("OPTIONS_TAB_GRAPHICS")
|
||||
keybinds.name = tr("OPTIONS_TAB_KEYBINDS")
|
||||
audio.name = tr("OPTIONS_TAB_AUDIO")
|
||||
|
||||
|
||||
func _on_cancel_pressed() -> void:
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_confirm_pressed() -> void:
|
||||
gameplay.save()
|
||||
graphics.save()
|
||||
keybinds.save()
|
||||
Data.graphics.apply_graphical_settings(get_viewport())
|
||||
Data.graphics.save_profile_to_disk()
|
||||
Data.audio.apply_audio_settings()
|
||||
Data.audio.save_profile_to_disk()
|
||||
Data.preferences.save_profile_to_disk()
|
||||
Data.keymap_data.apply()
|
||||
Data.keymap_data.save_to_disc()
|
||||
#Data.player_keymap.save_profile_to_disk()
|
||||
#Data.player_controller_keymap.append_input_map()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_button_hovered() -> void:
|
||||
$AudioStreamPlayer.play()
|
||||
@@ -1 +0,0 @@
|
||||
uid://48rvmybi18wj
|
||||
@@ -2,7 +2,6 @@ class_name PickupNotification
|
||||
extends PanelContainer
|
||||
|
||||
@export var fade_out_time: float
|
||||
@export var style: StyleBoxFlat
|
||||
@export var text_style: Color
|
||||
@export var common_background: Color
|
||||
@export var uncommon_background: Color
|
||||
@@ -15,19 +14,17 @@ var fading: bool = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
add_theme_stylebox_override("panel", style)
|
||||
$HBoxContainer/Label.add_theme_color_override("font_color", text_style)
|
||||
$HBoxContainer/Label2.add_theme_color_override("font_color", text_style)
|
||||
$Timer.start()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if fading:
|
||||
fade_time += delta
|
||||
style.bg_color.a = lerp(200.0 / 255.0, 0.0, fade_time / fade_out_time)
|
||||
text_style.a = lerp(220.0 / 255.0, 0.0, fade_time / fade_out_time)
|
||||
$HBoxContainer/Label.add_theme_color_override("font_color", text_style)
|
||||
$HBoxContainer/Label2.add_theme_color_override("font_color", text_style)
|
||||
var mod_color: Color = Color.WHITE
|
||||
mod_color.a = 1.0 - (fade_time / fade_out_time)
|
||||
modulate = mod_color
|
||||
#$HBoxContainer/Label.add_theme_color_override("font_color", text_style)
|
||||
#$HBoxContainer/Label2.add_theme_color_override("font_color", text_style)
|
||||
if fade_time >= fade_out_time:
|
||||
queue_free()
|
||||
|
||||
@@ -36,15 +33,15 @@ func set_card(card: Card) -> void:
|
||||
$HBoxContainer/Label.text = tr(card.display_name)
|
||||
match(card.rarity):
|
||||
Data.Rarity.COMMON:
|
||||
style.bg_color = common_background
|
||||
$HBoxContainer/Label.add_theme_color_override("font_color", common_background)
|
||||
Data.Rarity.UNCOMMON:
|
||||
style.bg_color = uncommon_background
|
||||
$HBoxContainer/Label.add_theme_color_override("font_color", uncommon_background)
|
||||
Data.Rarity.RARE:
|
||||
style.bg_color = rare_background
|
||||
$HBoxContainer/Label.add_theme_color_override("font_color", rare_background)
|
||||
Data.Rarity.EPIC:
|
||||
style.bg_color = epic_background
|
||||
$HBoxContainer/Label.add_theme_color_override("font_color", epic_background)
|
||||
Data.Rarity.LEGENDARY:
|
||||
style.bg_color = legendary_background
|
||||
$HBoxContainer/Label.add_theme_color_override("font_color", legendary_background)
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
|
||||
@@ -4,7 +4,7 @@ extends Node
|
||||
@export var sprite_container: Container ## Container that effect icons should be instantiated under
|
||||
|
||||
var enemy: EnemyController ## Enemy Controller that this node should affect
|
||||
var icon_scene: PackedScene = preload("res://Scenes/status_icon.tscn")
|
||||
var icon_scene: PackedScene = preload("res://UI/status_icon.tscn")
|
||||
var immunities: Array[StatusEffect] = [] ## The set of status effects that this effector shouldn't apply
|
||||
var effects: Dictionary[StatusEffect, int] = {}
|
||||
var icons: Dictionary[StatusEffect, TextureRect] = {}
|
||||
|
||||
Reference in New Issue
Block a user