fixed some ui stuff
This commit is contained in:
parent
0427a58635
commit
e63b765753
@ -7,7 +7,7 @@ var scope_mask : Texture
|
||||
func hold_second_trigger():
|
||||
super.hold_second_trigger()
|
||||
$CanvasLayer.set_visible(true)
|
||||
hero.zoom_factor = 3.0
|
||||
hero.set_zoom_factor(3.0)
|
||||
|
||||
|
||||
func release_second_trigger():
|
||||
|
@ -40,6 +40,10 @@ var currency := 0 :
|
||||
@export var sprint_zoom_speed := 0.2
|
||||
|
||||
|
||||
func set_zoom_factor(value):
|
||||
movement.zoom_factor = value
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if is_multiplayer_authority():
|
||||
right_hand_animator.play("weapon_sway")
|
||||
@ -149,11 +153,15 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
func unpause():
|
||||
paused = false
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
movement.set_process(true)
|
||||
movement.set_physics_process(true)
|
||||
|
||||
|
||||
func pause():
|
||||
paused = true
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
movement.set_process(false)
|
||||
movement.set_physics_process(false)
|
||||
|
||||
|
||||
func enter_editing_mode(value):
|
||||
|
@ -153,7 +153,6 @@ projection = 1
|
||||
size = 15.0
|
||||
script = ExtResource("12_3hpi3")
|
||||
anchor = NodePath("../..")
|
||||
face_north = true
|
||||
|
||||
[node name="HUD" type="CanvasLayer" parent="." node_paths=PackedStringArray("wave_count", "lives_count", "enemy_count", "currency_count", "crosshair", "minimap", "minimap_cam", "minimap_viewport", "fps_label", "enemy_sprites", "enemy_counts")]
|
||||
script = ExtResource("8_yl6ka")
|
||||
@ -306,6 +305,7 @@ horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="EnemyCount" type="Label" parent="HUD"]
|
||||
visible = false
|
||||
offset_left = 10.0
|
||||
offset_top = 80.0
|
||||
offset_right = 123.0
|
||||
|
@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://clulh7v8c7h85"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://clulh7v8c7h85"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/options_menu.gd" id="1_bievw"]
|
||||
[ext_resource type="PackedScene" uid="uid://clsdko6ttudu8" path="res://Scenes/UI/keybind_popup.tscn" id="2_bq25i"]
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_03x6q"]
|
||||
|
||||
[node name="OptionsMenu" type="PanelContainer" node_paths=PackedStringArray("look_sens_slider", "look_sens_input", "toggle_sprint_checkbox", "vsync_dropdown", "aa_dropdown", "window_dropdown", "invert_lookY", "invert_lookX", "fov_input", "fov_slider")]
|
||||
[node name="OptionsMenu" type="PanelContainer" node_paths=PackedStringArray("look_sens_slider", "look_sens_input", "toggle_sprint_checkbox", "vsync_dropdown", "aa_dropdown", "window_dropdown", "invert_lookY", "invert_lookX", "fov_input", "fov_slider", "fixed_minimap")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@ -15,6 +16,7 @@ offset_bottom = -30.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_bievw")
|
||||
keybind_popup = ExtResource("2_bq25i")
|
||||
look_sens_slider = NodePath("VBoxContainer/TabContainer/Gameplay/MouseSens/HBoxContainer/HSlider")
|
||||
look_sens_input = NodePath("VBoxContainer/TabContainer/Gameplay/MouseSens/HBoxContainer/SpinBox")
|
||||
toggle_sprint_checkbox = NodePath("VBoxContainer/TabContainer/Gameplay/ToggleSprint/CenterContainer/CheckButton")
|
||||
@ -25,6 +27,7 @@ invert_lookY = NodePath("VBoxContainer/TabContainer/Gameplay/InvertMouseY/Center
|
||||
invert_lookX = NodePath("VBoxContainer/TabContainer/Gameplay/InvertMouseX/CenterContainer/CheckButton")
|
||||
fov_input = NodePath("VBoxContainer/TabContainer/Graphics/FOV/HBoxContainer/SpinBox")
|
||||
fov_slider = NodePath("VBoxContainer/TabContainer/Graphics/FOV/HBoxContainer/HSlider")
|
||||
fixed_minimap = NodePath("VBoxContainer/TabContainer/Gameplay/FixedMinimap/CenterContainer/CheckButton")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
@ -119,6 +122,23 @@ size_flags_horizontal = 3
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="FixedMinimap" type="HBoxContainer" parent="VBoxContainer/TabContainer/Gameplay"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Gameplay/FixedMinimap"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Fixed Minimap"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/TabContainer/Gameplay/FixedMinimap"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="VBoxContainer/TabContainer/Gameplay/FixedMinimap/CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Graphics" type="VBoxContainer" parent="VBoxContainer/TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
38
Scenes/UI/keybind_popup.tscn
Normal file
38
Scenes/UI/keybind_popup.tscn
Normal file
@ -0,0 +1,38 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://clsdko6ttudu8"]
|
||||
|
||||
[ext_resource type="Script" path="res://keybind_screen.gd" id="1_m5i0b"]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_m5i0b")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 0.54902)
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -99.0
|
||||
offset_top = -13.0
|
||||
offset_right = 99.0
|
||||
offset_bottom = 13.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Press a key to bind action"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
@ -12,6 +12,7 @@ var last_lives_count = 120
|
||||
@export var minimap_viewport : SubViewport
|
||||
@export var fps_label : Label
|
||||
var minimap_anchor : Node3D
|
||||
var enemy_names = []
|
||||
@export var enemy_sprites : Array[TextureRect]
|
||||
@export var enemy_counts : Array[Label]
|
||||
|
||||
@ -35,12 +36,23 @@ func set_enemy_count(value):
|
||||
enemy_count.text = "Enemies Remaining: " + str(value)
|
||||
|
||||
|
||||
func enemy_count_down(enemy):
|
||||
var index = enemy_names.find(enemy.title)
|
||||
var num = enemy_counts[index].text.to_int() - 1
|
||||
enemy_counts[index].text = str(num)
|
||||
if num == 0:
|
||||
enemy_counts[index].set_visible(false)
|
||||
enemy_sprites[index].set_visible(false)
|
||||
|
||||
|
||||
func set_upcoming_wave(value):
|
||||
var frame_count = 0
|
||||
enemy_names = []
|
||||
for x in enemy_sprites.size():
|
||||
enemy_sprites[x].set_visible(false)
|
||||
enemy_counts[x].set_visible(false)
|
||||
for enemy in value:
|
||||
enemy_names.append(enemy.title)
|
||||
enemy_sprites[frame_count].texture = enemy.icon
|
||||
enemy_counts[frame_count].text = str(value[enemy])
|
||||
enemy_sprites[frame_count].set_visible(true)
|
||||
|
@ -11,6 +11,7 @@ const SAVE_PATH := "user://preferences.tres"
|
||||
@export var aa_mode := 0
|
||||
@export var windowed_mode := 0
|
||||
@export var hfov := 100.0
|
||||
@export var fixed_minimap := false
|
||||
|
||||
|
||||
func apply_graphical_settings(viewport):
|
||||
|
@ -8,8 +8,15 @@ var text_selected := false
|
||||
var username := "default"
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("Open Text Chat"):
|
||||
if text_selected:
|
||||
if !text_selected and event.is_action_pressed("Open Text Chat"):
|
||||
get_viewport().set_input_as_handled()
|
||||
opened.emit()
|
||||
$VBoxContainer/LineEdit.visible = true
|
||||
$VBoxContainer/LineEdit.grab_focus()
|
||||
text_selected = true
|
||||
return
|
||||
if text_selected and event is InputEventKey and event.pressed == true:
|
||||
if event.keycode == KEY_ENTER:
|
||||
closed.emit()
|
||||
$VBoxContainer/LineEdit.deselect()
|
||||
$VBoxContainer/LineEdit.visible = false
|
||||
@ -20,11 +27,11 @@ func _input(event: InputEvent) -> void:
|
||||
else:
|
||||
rpc("append_message", username, $VBoxContainer/LineEdit.text)
|
||||
$VBoxContainer/LineEdit.clear()
|
||||
else:
|
||||
opened.emit()
|
||||
$VBoxContainer/LineEdit.visible = true
|
||||
$VBoxContainer/LineEdit.grab_focus()
|
||||
text_selected = true
|
||||
if event.keycode == KEY_ESCAPE:
|
||||
closed.emit()
|
||||
$VBoxContainer/LineEdit.deselect()
|
||||
$VBoxContainer/LineEdit.visible = false
|
||||
text_selected = false
|
||||
|
||||
|
||||
func change_username(old_name, new_name):
|
||||
|
@ -34,7 +34,7 @@ func _ready() -> void:
|
||||
|
||||
cards.append(preload("res://PCs/Universal/ClassCards/Assault/card_assault.tres"))
|
||||
cards.append(preload("res://PCs/Universal/ClassCards/BombLauncher/card_grenade_launcher.tres"))
|
||||
cards.append(preload("res://PCs/Universal/ClassCards/Flamethrower/card_flamethrower.tres"))
|
||||
cards.append(preload("res://PCs/Universal/ClassCards/Sniper/card_sniper.tres"))
|
||||
cards.append(preload("res://PCs/Universal/ClassCards/Gatling/card_gatling.tres"))
|
||||
cards.append(preload("res://PCs/Universal/ClassCards/GlueLauncher/card_glue_launcher.tres"))
|
||||
cards.append(preload("res://PCs/Universal/ClassCards/RocketLauncher/card_rocket_launcher.tres"))
|
||||
|
@ -10,7 +10,7 @@ class_name EditTool
|
||||
|
||||
var enabled := true
|
||||
var point_id := -1
|
||||
var obstacle_last_point : int
|
||||
var obstacle_last_point := -1
|
||||
var valid_point := false
|
||||
var is_looking_at_tower_base := false
|
||||
var ray_collider
|
||||
|
@ -99,9 +99,11 @@ func increase_enemy_count():
|
||||
enemy_number_changed.emit(enemies)
|
||||
|
||||
|
||||
func enemy_died():
|
||||
func enemy_died(enemy):
|
||||
enemies -= 1
|
||||
enemy_number_changed.emit(enemies)
|
||||
for key in connected_players_nodes:
|
||||
connected_players_nodes[key].hud.enemy_count_down(enemy)
|
||||
for x in level.enemy_spawns:
|
||||
if !x.done_spawning:
|
||||
return
|
||||
@ -111,9 +113,11 @@ func enemy_died():
|
||||
win_game()
|
||||
|
||||
|
||||
func damage_goal(penalty):
|
||||
func damage_goal(enemy, penalty):
|
||||
enemies -= 1
|
||||
enemy_number_changed.emit(enemies)
|
||||
for key in connected_players_nodes:
|
||||
connected_players_nodes[key].hud.enemy_count_down(enemy)
|
||||
objective_health -= penalty
|
||||
base_took_damage.emit(objective_health)
|
||||
if objective_health <= 0:
|
||||
|
@ -2,9 +2,11 @@ extends Camera3D
|
||||
class_name MinimapCamera3D
|
||||
|
||||
@export var anchor : Node3D
|
||||
@export var face_north : bool
|
||||
#@export var face_north : bool
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
global_position = anchor.global_position + (Vector3.UP * 100)
|
||||
if face_north:
|
||||
if Data.preferences.fixed_minimap:
|
||||
rotation.y = 0
|
||||
else:
|
||||
rotation.y = anchor.rotation.y
|
||||
|
@ -1,6 +1,7 @@
|
||||
extends Control
|
||||
class_name OptionsMenu
|
||||
|
||||
@export var keybind_popup : PackedScene
|
||||
@export var look_sens_slider : HSlider
|
||||
@export var look_sens_input : SpinBox
|
||||
@export var toggle_sprint_checkbox : CheckButton
|
||||
@ -11,6 +12,7 @@ class_name OptionsMenu
|
||||
@export var invert_lookX : CheckButton
|
||||
@export var fov_input : SpinBox
|
||||
@export var fov_slider : HSlider
|
||||
@export var fixed_minimap : CheckButton
|
||||
var keybind_boxes = []
|
||||
var keybind_buttons = {}
|
||||
var key_event
|
||||
@ -28,6 +30,7 @@ func _ready():
|
||||
invert_lookX.button_pressed = Data.preferences.invert_lookX
|
||||
fov_input.value = Data.preferences.hfov
|
||||
fov_slider.value = Data.preferences.hfov
|
||||
fixed_minimap.button_pressed = Data.preferences.fixed_minimap
|
||||
|
||||
for index in Data.keymaps.size():
|
||||
var map = Data.keymaps[index]
|
||||
@ -81,6 +84,7 @@ func _on_confirm_pressed() -> void:
|
||||
Data.preferences.windowed_mode = window_dropdown.selected
|
||||
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.apply_graphical_settings(get_viewport())
|
||||
Data.preferences.save_profile_to_disk()
|
||||
Data.player_keymap.save_profile_to_disk()
|
||||
@ -112,12 +116,11 @@ func _on_fov_h_slider_value_changed(value: float) -> void:
|
||||
func _on_keybind_button_pressed(value: Button) -> void:
|
||||
selected_button = keybind_buttons[value]
|
||||
selected_button_button = value
|
||||
listening_for_key = true
|
||||
var popup = keybind_popup.instantiate()
|
||||
popup.event_detected.connect(change_key)
|
||||
add_child(popup)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if listening_for_key and (event is InputEventKey or event is InputEventMouseButton or event is InputEventJoypadButton):
|
||||
key_event = event
|
||||
listening_for_key = false
|
||||
Data.player_keymap.replace_action_event(selected_button, key_event)
|
||||
selected_button_button.text = key_event.as_text()
|
||||
func change_key(event: InputEvent):
|
||||
Data.player_keymap.replace_action_event(selected_button, event)
|
||||
selected_button_button.text = event.as_text()
|
||||
|
@ -1,8 +1,8 @@
|
||||
extends CharacterBody3D
|
||||
class_name AirEnemyController
|
||||
|
||||
signal reached_goal(penalty)
|
||||
signal died
|
||||
signal reached_goal(enemy, penalty)
|
||||
signal died(enemy)
|
||||
|
||||
var alive = true
|
||||
|
||||
@ -32,12 +32,12 @@ func _physics_process(delta: float) -> void:
|
||||
velocity = global_position.direction_to(destination.global_position) * movement_speed
|
||||
move_and_slide()
|
||||
if global_position.distance_to(destination.global_position) <= 1.0:
|
||||
reached_goal.emit(stats.penalty)
|
||||
reached_goal.emit(stats, stats.penalty)
|
||||
queue_free()
|
||||
|
||||
|
||||
func die():
|
||||
died.emit()
|
||||
died.emit(stats)
|
||||
queue_free()
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
extends PathFollow3D
|
||||
class_name EnemyController
|
||||
|
||||
signal reached_goal(penalty)
|
||||
signal died
|
||||
signal reached_goal(enemy, penalty)
|
||||
signal died(enemy)
|
||||
|
||||
var alive = true
|
||||
|
||||
@ -26,12 +26,12 @@ func damage(amount):
|
||||
func _physics_process(delta: float) -> void:
|
||||
progress += movement_speed * delta
|
||||
if progress_ratio >= 1:
|
||||
reached_goal.emit(stats.penalty)
|
||||
reached_goal.emit(stats, stats.penalty)
|
||||
queue_free()
|
||||
|
||||
|
||||
func die():
|
||||
died.emit()
|
||||
died.emit(stats)
|
||||
queue_free()
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
15
keybind_screen.gd
Normal file
15
keybind_screen.gd
Normal file
@ -0,0 +1,15 @@
|
||||
extends Control
|
||||
|
||||
signal event_detected(event: InputEvent)
|
||||
|
||||
var found_event = false
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if found_event:
|
||||
return
|
||||
if event is InputEventKey or event is InputEventMouseButton or event is InputEventJoypadButton:
|
||||
get_viewport().set_input_as_handled()
|
||||
found_event = true
|
||||
event_detected.emit(event)
|
||||
queue_free()
|
||||
|
Loading…
x
Reference in New Issue
Block a user