MainMenu.gd
Main menu script that control main menu, here we can change main menu full visual and controls
var load_btn : Dictionary # loading button description ID, text ID
var mm_buttons : Array # all menu buttons descriptions, ID, text ID
var last_opt_chnanged : Array
var languages : Array
var credits_strings : Array
var selected_index : int
var pseudo_anim_btn_speed : float
var sound_enabled : bool
#Variables of options buttons
@onready var version_title : RichTextLabel = $versionTitle
@onready var selected_button : Label = $ClickableTitle
@onready var left_button : Label = $NonClickableLeft
@onready var right_button : Label = $NonClickableRight
@onready var about_menu : Control = $MenuAbout
@onready var options_menu : Control = $Options
@onready var first_launch_menu : Control = $FirstLaunchWindow
@onready var logo : TextureRect = $Logo
@onready var background_color : ColorRect = self
@onready var opt_lang_btn : Button
@onready var opt_sounds_btn : Button
@onready var opt_aim_btn : Button
@onready var opt_autoreload_btn : Button
@onready var opt_fps_btn : Button
@onready var opt_lang_first_launch : Button
@onready var opt_difficulty_first_launch : Button
@onready var opt_vsync_btn : Button
@onready var opt_mouse_smooth_btn : Button
@onready var opt_mouse_sens_btn : Button
@onready var opt_vol_main_btn : Button
@onready var opt_vol_amb_btn : Button
@onready var opt_vol_sfx_btn : Button
@onready var opt_vol_music_btn : Button
@onready var opt_vol_fx_btn : Button
@onready var opt_fps_lock_btn : Button
@onready var opt_scale_3d_btn : Button
@onready var opt_difficulty_btn : Button
@onready var opt_slider_main
@onready var opt_slider_amb
@onready var opt_slider_sfx
@onready var opt_slider_music
@onready var opt_slider_fx
@onready var opt_slider_mouse_smooth
@onready var opt_slider_mouse_sens
@onready var opt_slider_3d_scale
@onready var opt_ssao_btn : Button
@onready var opt_dithering_btn : Button
@onready var opt_glow_btn : Button
@onready var opt_volumetric_fog_btn : Button
@onready var opt_moving_sky_btn : Button
@onready var opt_pixelation_btn : Button
@onready var opt_cam_sway : Button
@onready var opt_corpses : Button
@onready var splash_blocker
@onready var about_scroll : ScrollContainer
# mobile features for swipes
var touch_start_position : Vector2
var touch_end_position : Vector2
var about_autoscroll : bool
var color_active = "ee9d31" #hex color
var color_disabled = "66625f" #hex color
var current_lang : int
# functions
func opt() #returns options.json data
func credits() #returns credist.json data
func pseudo_btn_animation() #fake animation for left and right buttons
func add_volume_bus(bus_name) #add volume for master sound
func low_volume_bus(bus_name) #low volume from master sound
func get_percent(value) #calculate percentage where -80db is 0% and 0db is 100%
func OnSplashFinishedAll() # when all splashes finished - play music
func _update_options() #update all options UI
func _set_ui_opt_text() # update options text with translation for YES/NO elements (example - Sounds: YES, Music: NO)
func UpdateSelector() #updates main menu button selector (also shown load button if *.save file exists)
func MinusIndex() #calls when player press on the <, or left arrow, or A in main menu
func PlusIndex() #calls when player press on the >, or rightarrow, or D in main menu
func add_inputs_options() # add input action to the game from options (inventory on I, PDA on P or M etc.)
func load_credits() # load credits data from credits.json and fill all UI in credits window
func _on_non_clickable_right_gui_input() # calls PlusIndex()
func _on_non_clickable_left_gui_input() # calls MinusIndex()
func _on_clickable_title_gui_input() # when player click on text in center, same as press ENTER
func _on_opt_lang_pressed() # changes language
func save_to_options() # saves data to options, have data argument
func _on_opt_snd_pressed() #turn on/off sounds in the game and write changes to options file
func _on_back_pressed() # back from options
func _on_opt_difficulty_fl_pressed() # changes difficulty and saves to options file
Last updated