Change PascalCase variables to camelCase to avoid futue class shadowing

This commit is contained in:
Luke Hubmayer-Werner 2024-03-22 21:27:13 +10:30
parent 11d95ff441
commit e2cb6e2bbc
9 changed files with 204 additions and 199 deletions

28
main.gd
View File

@ -1,22 +1,22 @@
extends Control
export var MainMenuPath := @'MainMenu'
onready var MainMenu := get_node(MainMenuPath)
export var mainMenuPath := @'MainMenu'
onready var mainMenu := get_node(mainMenuPath)
const TouchGamePath := 'res://scenes/RadialGame.tscn'
const StepGamePath := 'res://scenes/StepGame.tscn'
var TouchGameScene := preload(TouchGamePath)
var StepGameScene := preload(StepGamePath)
const touchGamePath := 'res://scenes/RadialGame.tscn'
const stepGamePath := 'res://scenes/StepGame.tscn'
var touchGameScene := preload(touchGamePath)
var stepGameScene := preload(stepGamePath)
var ActiveGame: Node = null
var activeGame: Node = null
func _on_MainMenu_start_stepgame() -> void:
MainMenu.hide()
ActiveGame = StepGameScene.instance()
add_child_below_node(MainMenu, ActiveGame)
mainMenu.hide()
activeGame = stepGameScene.instance()
add_child_below_node(mainMenu, activeGame)
func _on_MainMenu_start_touchgame() -> void:
MainMenu.hide()
ActiveGame = TouchGameScene.instance()
add_child_below_node(MainMenu, ActiveGame)
ActiveGame.alignment_horizontal = AspectRatioContainer.ALIGN_BEGIN
mainMenu.hide()
activeGame = touchGameScene.instance()
add_child_below_node(mainMenu, activeGame)
activeGame.alignment_horizontal = AspectRatioContainer.ALIGN_BEGIN

View File

@ -178,8 +178,8 @@ __meta__ = {
}
[node name="Menu" parent="Square" instance=ExtResource( 10 )]
NoteHandlerPath = NodePath("../NoteHandler")
ReceptorsPath = NodePath("../Receptors")
noteHandlerPath = NodePath("../NoteHandler")
receptorsPath = NodePath("../Receptors")
ease_curve = SubResource( 7 )
[node name="Bezel" type="Control" parent="Square"]

View File

@ -110,7 +110,6 @@ __meta__ = {
[node name="Viewport" type="Viewport" parent="NoteHandler"]
size = Vector2( 1080, 1080 )
transparent_bg = true
usage = 1
render_target_v_flip = true
script = ExtResource( 1 )
@ -157,7 +156,7 @@ script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
ViewportPath = NodePath("../Viewport")
viewportPath = NodePath("../Viewport")
[node name="StepMenu" parent="." instance=ExtResource( 5 )]

View File

@ -9,12 +9,12 @@ signal combo_changed(value)
var running := false
var song_key = ''
onready var MusicPlayer := SoundPlayer.music_player
onready var VideoPlayer := Video.video
onready var musicPlayer := SoundPlayer.music_player
onready var videoPlayer := Video.video
onready var Painter = $'../Painter'
onready var SlideTrailHandler = $'Viewport/Center/SlideTrailHandler'
onready var JudgeText = $'Viewport/Center/JudgeText'
onready var painter = $'../Painter'
onready var slideTrailHandler = $'Viewport/Center/SlideTrailHandler'
onready var judgeText = $'Viewport/Center/JudgeText'
onready var notelines = $'Viewport/Center/notelines'
onready var meshinstance = $'Viewport/Center/meshinstance'
onready var lbl_combo = $lbl_combo
@ -266,7 +266,7 @@ func _draw():
var textmesh := ArrayMesh.new()
for text in active_judgement_texts:
RadialMeshTools.make_judgement_text(textmesh, RadialMeshTools.TextJudgement[text.judgement], text.col, (t-text.time)/GameTheme.judge_text_duration)
JudgeText.set_mesh(textmesh)
judgeText.set_mesh(textmesh)
func _input(event):
@ -365,8 +365,8 @@ func load_track(song_key: String, difficulty_key: String):
sync_offset_audio = data.audio_offsets[0]
sync_offset_video = data.video_offsets[0]
var videostream = FileLoader.load_video('songs/' + data.filepath.rstrip('/') + '/' + data.video_filelist[0])
MusicPlayer.set_stream(FileLoader.load_ogg('songs/' + data.filepath.rstrip('/') + '/' + data.audio_filelist[0]))
VideoPlayer.set_stream(videostream)
musicPlayer.set_stream(FileLoader.load_ogg('songs/' + data.filepath.rstrip('/') + '/' + data.audio_filelist[0]))
videoPlayer.set_stream(videostream)
# all_notes = FileLoader.Test.stress_pattern()
Note.process_note_list(all_notes, false)
@ -378,8 +378,8 @@ func load_track(song_key: String, difficulty_key: String):
func stop():
MusicPlayer.stop()
VideoPlayer.stop()
musicPlayer.stop()
videoPlayer.stop()
# running = false
next_note_to_load = 10000000 # Hacky but whatever
@ -437,14 +437,14 @@ func _process(delta):
timer.connect('timeout', timer, 'queue_free')
var vt_delta := time - video_start_time()
if (0.0 <= vt_delta) and (vt_delta < 3.0) and not VideoPlayer.is_playing():
VideoPlayer.play()
VideoPlayer.set_stream_position(vt_delta)
if (0.0 <= vt_delta) and (vt_delta < 3.0) and not videoPlayer.is_playing():
videoPlayer.play()
videoPlayer.set_stream_position(vt_delta)
var at_delta := time - audio_start_time()
if (0.0 <= at_delta) and (at_delta < 3.0) and not MusicPlayer.is_playing():
# MusicPlayer.play()
# MusicPlayer.seek(at_delta)
MusicPlayer.play(at_delta)
if (0.0 <= at_delta) and (at_delta < 3.0) and not musicPlayer.is_playing():
# musicPlayer.play()
# musicPlayer.seek(at_delta)
musicPlayer.play(at_delta)
# Clean out expired notes
var miss_time: float = Rules.JUDGEMENT_TIMES_POST[-1] * bpm/60.0
@ -457,7 +457,7 @@ func _process(delta):
scores[Note.RELEASE_SCORE_TYPES[Note.NOTE_HOLD]][3] += 1
make_judgement_column(3, note.column)
Note.NOTE_SLIDE:
SlideTrailHandler.remove_child(slide_trail_mesh_instances[note.slide_id])
slideTrailHandler.remove_child(slide_trail_mesh_instances[note.slide_id])
slide_trail_mesh_instances.erase(note.slide_id)
var idx = active_slide_trails.find(note)
if idx > -1:
@ -504,14 +504,14 @@ func _process(delta):
meshi.material.set_shader_param('trail_progress', 0.0)
meshi.set_texture(GameTheme.tex_slide_arrow)
slide_trail_mesh_instances[note.slide_id] = meshi
SlideTrailHandler.add_child(meshi)
slideTrailHandler.add_child(meshi)
next_note_to_load += 1
if (
next_note_to_load >= len(all_notes)
and not VideoPlayer.is_playing()
and not MusicPlayer.is_playing()
and not videoPlayer.is_playing()
and not musicPlayer.is_playing()
and active_notes.empty()
and active_judgement_texts.empty()
and slide_trail_mesh_instances.empty()
@ -524,7 +524,7 @@ func _process(delta):
# Redraw
meshinstance.material.set_shader_param('screen_size', get_viewport().get_size())
update()
Painter.update()
painter.update()
func _on_InputHandler_column_pressed(column) -> void:

View File

@ -1,8 +1,8 @@
extends Control
export var ViewportPath := @'../NoteHandler/Viewport'
onready var Viewport := get_node(ViewportPath)
export var viewportPath := @'../NoteHandler/Viewport'
onready var viewport := get_node(viewportPath)
func _draw():
draw_texture_rect(Viewport.get_texture(), Rect2(Vector2.ZERO, rect_size), false)
# texture = Viewport.get_texture()
draw_texture_rect(viewport.get_texture(), Rect2(Vector2.ZERO, rect_size), false)
# texture = viewport.get_texture()

View File

@ -1,8 +1,8 @@
extends Viewport
export var SquarePath := @'../../'
onready var Square := get_node(SquarePath)
onready var Root := $'/root'
export var squarePath := @'../../'
onready var square := get_node(squarePath)
onready var root := $'/root'
onready var base_height = 1080.0
var container_size := Vector2(1080, 1080)
@ -14,14 +14,14 @@ func set_render_scale(scale: Vector2):
$Center.scale = size/base_height
func update_size() -> void:
var winscale = min(Root.size.x, Root.size.y)/base_height
container_size = Square.rect_size * winscale
var winscale = min(root.size.x, root.size.y)/base_height
container_size = square.rect_size * winscale
set_render_scale(scale)
# Called when the node enters the scene tree for the first time.
func _ready():
Settings.connect('subsampling_changed', self, 'set_render_scale')
Square.connect('item_rect_changed', self, 'update_size')
Root.connect('size_changed', self, 'update_size')
square.connect('item_rect_changed', self, 'update_size')
root.connect('size_changed', self, 'update_size')
scale = Settings.subsampling
update_size()

View File

@ -1,7 +1,7 @@
extends Node2D
var TitleFont := preload("res://assets/MenuTitleFont.tres").duplicate()
var ScoreFont := preload("res://assets/MenuScoreFont.tres").duplicate()
var titleFont := preload("res://assets/MenuTitleFont.tres").duplicate()
var scoreFont := preload("res://assets/MenuScoreFont.tres").duplicate()
var score = ""
var score_sub = ""
@ -9,16 +9,16 @@ var score_sub = ""
var f_scale := 1.0 setget set_f_scale
func set_f_scale(value: float) -> void:
f_scale = value
TitleFont.size = int(round(32*f_scale))
TitleFont.outline_size = int(max(round(2*f_scale), 1))
ScoreFont.size = int(round(96*f_scale))
ScoreFont.outline_size = int(max(round(2*f_scale), 1))
titleFont.size = int(round(32*f_scale))
titleFont.outline_size = int(max(round(2*f_scale), 1))
scoreFont.size = int(round(96*f_scale))
scoreFont.outline_size = int(max(round(2*f_scale), 1))
func draw_string_centered(font, position, string, color := Color.white):
draw_string(font, Vector2(position.x - font.get_string_size(string).x/2.0, position.y + font.get_ascent()), string, color)
func _draw():
if score:
draw_string_centered(ScoreFont, Vector2(0, 0)*f_scale, score)
draw_string_centered(scoreFont, Vector2(0, 0)*f_scale, score)
if score_sub:
draw_string_centered(TitleFont, Vector2(0, 128)*f_scale, score_sub)
draw_string_centered(titleFont, Vector2(0, 128)*f_scale, score_sub)

View File

@ -1,23 +1,23 @@
#tool
extends Control
export var NoteHandlerPath := @'../NoteHandler'
export var ReceptorsPath := @'../Receptors'
onready var NoteHandler := get_node(NoteHandlerPath)
onready var Receptors := get_node(ReceptorsPath)
onready var ScoreText := $ScoreText
export var noteHandlerPath := @'../NoteHandler'
export var receptorsPath := @'../Receptors'
onready var noteHandler := get_node(noteHandlerPath)
onready var receptors := get_node(receptorsPath)
onready var scoreText := $ScoreText
onready var PVMusic := SoundPlayer.music_player_pv
var f_scale := 1.0 setget set_f_scale
func set_f_scale(value: float) -> void:
f_scale = value
TitleFont.size = int(round(32*f_scale))
TitleFont.outline_size = int(max(round(2*f_scale), 1))
GenreFont.size = int(round(48*f_scale))
GenreFont.outline_size = int(max(round(2*f_scale), 1))
DiffNumFont.size = int(round(36*f_scale))
DiffNumFont.outline_size = int(max(round(1*f_scale), 1))
ScoreText.set_f_scale(f_scale)
titleFont.size = int(round(32*f_scale))
titleFont.outline_size = int(max(round(2*f_scale), 1))
genreFont.size = int(round(48*f_scale))
genreFont.outline_size = int(max(round(2*f_scale), 1))
diffNumFont.size = int(round(36*f_scale))
diffNumFont.outline_size = int(max(round(1*f_scale), 1))
scoreText.set_f_scale(f_scale)
func update_scale() -> void:
self.f_scale = min(rect_size.x/1080, rect_size.y/1080)
@ -59,10 +59,10 @@ var scorescreen_saved := false
var touch_rects = []
var TitleFont: DynamicFont = preload('res://assets/MenuTitleFont.tres').duplicate()
var GenreFont: DynamicFont = preload('res://assets/MenuGenreFont.tres').duplicate()
var DiffNumFont: DynamicFont = preload('res://assets/MenuDiffNumberFont.tres').duplicate()
var ScoreFont: DynamicFont = preload('res://assets/MenuScoreFont.tres').duplicate()
var titleFont: DynamicFont = preload('res://assets/MenuTitleFont.tres').duplicate()
var genreFont: DynamicFont = preload('res://assets/MenuGenreFont.tres').duplicate()
var diffNumFont: DynamicFont = preload('res://assets/MenuDiffNumberFont.tres').duplicate()
var scoreFont: DynamicFont = preload('res://assets/MenuScoreFont.tres').duplicate()
var snd_interact := preload('res://assets/softclap.wav')
var snd_error := preload('res://assets/miss.wav')
@ -84,12 +84,17 @@ class lerp_array extends Resource:
return len(array)
var joypad_labels = []
onready var joypad_monitors = [$JoypadMonitor, $JoypadMonitor2, $JoypadMonitor3]
func update_joypad_labels():
var num_joypads = Input.get_connected_joypads()
joypad_labels = []
var num_joypads = len(Input.get_connected_joypads())
var num_monitors = len(joypad_monitors)
for i in num_monitors:
joypad_monitors[i].visible = true
if num_monitors > num_joypads:
for i in range(num_joypads, num_monitors):
joypad_monitors[i].visible = false
for i in num_joypads:
joypad_labels.append(Input.get_joy_name(i))
joypad_monitors[i].set_name(Input.get_joy_name(i))
func get_rect_center(rect: Rect2) -> Vector2:
return rect.position + rect.size*0.5
@ -138,7 +143,7 @@ func load_preview():
func _ready():
scan_library()
connect('item_rect_changed', self, 'update_scale')
NoteHandler.connect('finished_song', self, 'finished_song')
noteHandler.connect('finished_song', self, 'finished_song')
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
@ -160,9 +165,9 @@ func _process(delta):
menu_mode_prev_fade_timer = max(0.0, menu_mode_prev_fade_timer - delta)
update()
if (menu_mode == MenuMode.GAMEPLAY) and (menu_mode_prev_fade_timer <= 0.0) and not NoteHandler.running:
NoteHandler.load_track(self.selected_song_key, Library.Song.default_difficulty_keys[selected_difficulty])
NoteHandler.running = true
if (menu_mode == MenuMode.GAMEPLAY) and (menu_mode_prev_fade_timer <= 0.0) and not noteHandler.running:
noteHandler.load_track(self.selected_song_key, Library.Song.default_difficulty_keys[selected_difficulty])
noteHandler.running = true
func draw_string_centered(font: Font, position: Vector2, string: String, color := GameTheme.COLOR_MENU_TEXT, vcenter := false) -> Vector2:
@ -197,11 +202,11 @@ func draw_songtile(song_key, position, size, title_text:=false, difficulty=selec
draw_rect(Rect2(position.x - outline_px, position.y - outline_px, size + outline_px*2, size + outline_px*2), diff_color)
draw_texture_rect(Library.get_song_tile_texture(song_key), rect, false, Color.white if not disabled else Color(0.5, 0.2, 0.1))
# Draw track difficulty rating
draw_string_ralign(DiffNumFont, position+Vector2(size-2*f_scale, size-5*f_scale), song_diffs.get(Library.Song.default_difficulty_keys[difficulty], '0'), diff_color)
draw_string_ralign(diffNumFont, position+Vector2(size-2*f_scale, size-5*f_scale), song_diffs.get(Library.Song.default_difficulty_keys[difficulty], '0'), diff_color)
if disabled:
draw_string_centered(DiffNumFont, position+Vector2(size/2, size/2), 'No Chart!', diff_color, true)
draw_string_centered(diffNumFont, position+Vector2(size/2, size/2), 'No Chart!', diff_color, true)
if title_text:
draw_string_centered(TitleFont, position+Vector2(size/2.0, size+40*f_scale), str(Library.all_songs[song_key].title), diff_color.lightened(0.33))
draw_string_centered(titleFont, position+Vector2(size/2.0, size+40*f_scale), str(Library.all_songs[song_key].title), diff_color.lightened(0.33))
return rect
func diff_f2str(difficulty: float): # Convert .5 to +
@ -218,8 +223,8 @@ func _draw_song_select(center: Vector2) -> Array:
var touchrects := []
if len(genres) <= 0:
draw_string_centered(GenreFont, Vector2(center.x, center.y-440*f_scale), 'No Songs in Library!', Color.aqua)
draw_string_centered(DiffNumFont, Vector2(center.x, center.y-390*f_scale), FileLoader.userroot, Color.lightgreen)
draw_string_centered(genreFont, Vector2(center.x, center.y-440*f_scale), 'No Songs in Library!', Color.aqua)
draw_string_centered(diffNumFont, Vector2(center.x, center.y-390*f_scale), FileLoader.userroot, Color.lightgreen)
return touchrects
var ssid = self.selected_song_idx
@ -233,7 +238,7 @@ func _draw_song_select(center: Vector2) -> Array:
var gx = center.x - (subsize + spacer_x) * s_delta
var songslist = Library.genre_songs[g].keys()
var genre_str = '%s (%d songs)'%[genres.keys()[g], len(songslist)]
draw_string_centered(GenreFont, Vector2(center.x, gy), genre_str, Color.lightblue)
draw_string_centered(genreFont, Vector2(center.x, gy), genre_str, Color.lightblue)
var s = len(songslist)
var key = songslist[self.selected_song_idx % s]
@ -266,8 +271,8 @@ func _draw_song_select(center: Vector2) -> Array:
var cs = PoolColorArray([Color(0,0,0.1,1.25), Color(0,0,0.1,1.25), Color(0,0,0,0), Color(0,0,0,0)])
draw_polygon(ps, cs)
draw_polygon(ps2, cs)
draw_string_centered(GenreFont, Vector2(center.x, center.y-440*f_scale), 'Select Song', Color.aqua)
draw_string_centered(DiffNumFont, Vector2(center.x, center.y-390*f_scale), 'Tap to scroll, tap focused to select', Color.lightgreen)
draw_string_centered(genreFont, Vector2(center.x, center.y-440*f_scale), 'Select Song', Color.aqua)
draw_string_centered(diffNumFont, Vector2(center.x, center.y-390*f_scale), 'Tap to scroll, tap focused to select', Color.lightgreen)
return touchrects
func _draw_chart_select(center: Vector2) -> Array:
@ -280,9 +285,9 @@ func _draw_chart_select(center: Vector2) -> Array:
var size = min(192, (1000-spacer_x*(n-1))/n) * f_scale
var rect_back = Rect2(center + Vector2(-300.0, 390.0)*f_scale, Vector2(600.0, 140.0)*f_scale)
draw_rect(rect_back, Color.red)
draw_string_centered(TitleFont, get_rect_center(rect_back), 'Back to song selection', Color.white, true)
draw_string_centered(GenreFont, center+Vector2(0, -360*f_scale), 'Select Difficulty', Color.aqua)
draw_string_centered(DiffNumFont, center+Vector2(0, -300*f_scale), 'Tap to show stats, tap focused to play', Color.lightgreen)
draw_string_centered(titleFont, get_rect_center(rect_back), 'Back to song selection', Color.white, true)
draw_string_centered(genreFont, center+Vector2(0, -360*f_scale), 'Select Difficulty', Color.aqua)
draw_string_centered(diffNumFont, center+Vector2(0, -300*f_scale), 'Tap to show stats, tap focused to play', Color.lightgreen)
var touchrects = [{rect=rect_back, chart_idx=-1, enabled=true}] # invisible back button
var x = center.x - (size*n + spacer_x*(n-1))/2
@ -293,10 +298,10 @@ func _draw_chart_select(center: Vector2) -> Array:
var r = draw_songtile(self.selected_song_key, Vector2(x, center.y-160*f_scale), size, false, i_diff, width, not chart_exists)
touchrects.append({rect=r, chart_idx=i_diff, enabled=chart_exists})
x += size + spacer_x
draw_string_centered(TitleFont, center+Vector2(0, size-116*f_scale), str(Library.all_songs[self.selected_song_key].title))
draw_string_centered(titleFont, center+Vector2(0, size-116*f_scale), str(Library.all_songs[self.selected_song_key].title))
draw_string_centered(TitleFont, center+Vector2(-50*f_scale, size-64*f_scale), 'BPM:')
draw_string_centered(TitleFont, center+Vector2(+50*f_scale, size-64*f_scale), str(song_data.BPM))
draw_string_centered(titleFont, center+Vector2(-50*f_scale, size-64*f_scale), 'BPM:')
draw_string_centered(titleFont, center+Vector2(+50*f_scale, size-64*f_scale), str(song_data.BPM))
if len(charts) > 0:
var sel_chart: Array = charts.values()[min(selected_difficulty, len(charts)-1)]
@ -307,10 +312,10 @@ func _draw_chart_select(center: Vector2) -> Array:
var notetypes = [0, 1, 2]
var note_counts = [meta.num_taps, meta.num_holds, meta.num_slides]
for i in len(notestrs):
draw_string_centered(TitleFont, center+Vector2(-50*f_scale, size+(12+i*50)*f_scale), notestrs[i])
draw_string_centered(TitleFont, center+Vector2(+50*f_scale, size+(12+i*50)*f_scale), str(note_counts[notetypes[i]]))
draw_string_centered(titleFont, center+Vector2(-50*f_scale, size+(12+i*50)*f_scale), notestrs[i])
draw_string_centered(titleFont, center+Vector2(+50*f_scale, size+(12+i*50)*f_scale), str(note_counts[notetypes[i]]))
else:
draw_string_centered(TitleFont, center+Vector2(0, size-12*f_scale), 'No available charts!', Color.red)
draw_string_centered(titleFont, center+Vector2(0, size-12*f_scale), 'No available charts!', Color.red)
return touchrects
@ -340,7 +345,7 @@ func _draw_score_screen(center: Vector2) -> Array:
var judgement_text_size = Vector2(256, 64) * judgement_text_scale
draw_songtile(song_key, center + Vector2.LEFT*size*0.5 + Vector2(-x_score, y_score)*f_scale, size, false, selected_difficulty, 3)
draw_string_centered(TitleFont, center + Vector2.DOWN*size + Vector2(-x_score, y_score+48)*f_scale, str(Library.all_songs[song_key].title))
draw_string_centered(titleFont, center + Vector2.DOWN*size + Vector2(-x_score, y_score+48)*f_scale, str(Library.all_songs[song_key].title))
var notestrs = ['Taps (%d):'%meta.num_taps, 'Holds (%d) Hit:'%meta.num_holds, 'Released:', 'Stars (%d):'%meta.num_slides, 'Slides:']
var notetypes = [0, 1, -1, 2, -2]
var note_spacing = [0.0, 1.25, 2.25, 3.5, 4.5]
@ -355,10 +360,10 @@ func _draw_score_screen(center: Vector2) -> Array:
for i in len(judgestrs):
# For each judgement type, print a column header
# draw_string_centered(TitleFont, Vector2(x2+x_spacing*(i+1), y2), judgestrs[i])
# draw_string_centered(titleFont, Vector2(x2+x_spacing*(i+1), y2), judgestrs[i])
var dst_rect = Rect2(center+Vector2(x2+x_spacing*(i+1)-judgement_text_size.x*f_scale/2.0, y2), judgement_text_size*f_scale)
draw_texture_rect_region(tex_judgement_text, dst_rect, Rect2(0, 128*(i+3), 512, 128))
draw_string_centered(TitleFont, center+Vector2(x2+x_spacing*(len(judgestrs)+1), y2+34*f_scale), 'Score')
draw_string_centered(titleFont, center+Vector2(x2+x_spacing*(len(judgestrs)+1), y2+34*f_scale), 'Score')
for i in len(notestrs):
# For each note type, make a row and print scores
@ -366,7 +371,7 @@ func _draw_score_screen(center: Vector2) -> Array:
var note_score = 0
var note_count = 0
var y_row = y3 + y_spacing * (note_spacing[i]+1)
draw_string_centered(TitleFont, center+Vector2(x2-20*f_scale, y_row), notestrs[i])
draw_string_centered(titleFont, center+Vector2(x2-20*f_scale, y_row), notestrs[i])
for j in len(judgestrs):
var score
if j == 0:
@ -378,13 +383,13 @@ func _draw_score_screen(center: Vector2) -> Array:
notecount_early += scorescreen_score_data[idx][-j]
notecount_late += scorescreen_score_data[idx][j]
if (j >= len(judgestrs)-1) and (idx == -1):
draw_string_centered(TitleFont, center+Vector2(x2+x_spacing*(j+1), y_row), '^')
draw_string_centered(titleFont, center+Vector2(x2+x_spacing*(j+1), y_row), '^')
else:
draw_string_centered(TitleFont, center+Vector2(x2+x_spacing*(j+1), y_row), str(score))
draw_string_centered(titleFont, center+Vector2(x2+x_spacing*(j+1), y_row), str(score))
notecount_total += score # Kinda redundant, will probably refactor eventually
note_count += score
note_score += score * judge_scores[j]
draw_string_centered(TitleFont, center+Vector2(x2+x_spacing*(len(judgestrs)+1), y_row), '%2.2f%%'%(note_score/max(note_count, 1)*100.0))
draw_string_centered(titleFont, center+Vector2(x2+x_spacing*(len(judgestrs)+1), y_row), '%2.2f%%'%(note_score/max(note_count, 1)*100.0))
total_score += note_score * notetype_weights[i]
total_scoremax += note_count * notetype_weights[i]
@ -395,31 +400,31 @@ func _draw_score_screen(center: Vector2) -> Array:
break
else:
score_idx += 1
ScoreText.position = center+Vector2(x_score, y_score)*f_scale
ScoreText.score = Rules.SCORE_STRINGS[score_idx]
ScoreText.score_sub = '%2.3f%%'%(overall_score*100.0)
ScoreText.update()
scoreText.position = center+Vector2(x_score, y_score)*f_scale
scoreText.score = Rules.SCORE_STRINGS[score_idx]
scoreText.score_sub = '%2.3f%%'%(overall_score*100.0)
scoreText.update()
draw_string_centered(TitleFont, center+Vector2(-150, y3+y_spacing*7), 'Early : Late')
draw_string_centered(TitleFont, center+Vector2(-150, y3+y_spacing*8), '%3d%% : %3d%%'%[notecount_early*100/max(notecount_total, 1), notecount_late*100/max(notecount_total, 1)])
draw_string_centered(TitleFont, center+Vector2(150, y3+y_spacing*7.5), 'Max Combo: %d'%scorescreen_score_data.get('max_combo', 0)) # Safety for older saves
draw_string_centered(titleFont, center+Vector2(-150, y3+y_spacing*7), 'Early : Late')
draw_string_centered(titleFont, center+Vector2(-150, y3+y_spacing*8), '%3d%% : %3d%%'%[notecount_early*100/max(notecount_total, 1), notecount_late*100/max(notecount_total, 1)])
draw_string_centered(titleFont, center+Vector2(150, y3+y_spacing*7.5), 'Max Combo: %d'%scorescreen_score_data.get('max_combo', 0)) # Safety for older saves
var txt_offset = Vector2.DOWN*10*f_scale
var rect_songs := Rect2(center+Vector2(-100.0, 300.0)*f_scale, Vector2(400.0, 100.0)*f_scale)
draw_rect(rect_songs, Color.red)
draw_string_centered(TitleFont, get_rect_center(rect_songs), 'Song Select', Color.white, true)
draw_string_centered(titleFont, get_rect_center(rect_songs), 'Song Select', Color.white, true)
touchrects.append({rect=rect_songs, next_menu=MenuMode.SONG_SELECT})
var rect_save := Rect2(center+Vector2(-300.0, 300.0)*f_scale, Vector2(180.0, 100.0)*f_scale)
if not scorescreen_saved:
draw_rect(rect_save, Color(0.0, 0.01, 1.0))
draw_string_centered(TitleFont, get_rect_center(rect_save), 'Save', Color.white, true)
draw_string_centered(titleFont, get_rect_center(rect_save), 'Save', Color.white, true)
touchrects.append({rect=rect_save, action='save'})
else:
draw_rect(rect_save, Color.darkgray)
draw_string_centered(TitleFont, get_rect_center(rect_save), 'Saved', Color.white, true)
draw_string_centered(titleFont, get_rect_center(rect_save), 'Saved', Color.white, true)
draw_string_centered(GenreFont, center+Vector2.UP*410*f_scale, 'Results', Color.aqua)
draw_string_centered(genreFont, center+Vector2.UP*410*f_scale, 'Results', Color.aqua)
return touchrects
func _draw_gameplay(center: Vector2) -> Array:
@ -427,7 +432,7 @@ func _draw_gameplay(center: Vector2) -> Array:
var rect_songselect := Rect2(center+Vector2(+860.0, 480.0)*f_scale, Vector2(100.0, 50.0)*f_scale)
draw_rect(rect_songselect, Color.red)
draw_string_centered(TitleFont, get_rect_center(rect_songselect), 'Stop', Color.white, true)
draw_string_centered(titleFont, get_rect_center(rect_songselect), 'Stop', Color.white, true)
touchrects.append({rect=rect_songselect, action='stop'})
return touchrects
@ -439,7 +444,7 @@ func _draw():
var outline_px = 3
var center = rect_size * 0.5
touch_rects = []
ScoreText.hide()
scoreText.hide()
for i in MenuMode:
touch_rects.append([])
@ -469,7 +474,7 @@ func _draw():
GameTheme.set_screen_filter_alpha(1.0 - progress)
MenuMode.SCORE_SCREEN:
_draw_score_screen(center_next)
ScoreText.show()
scoreText.show()
else:
match menu_mode:
MenuMode.SONG_SELECT:
@ -486,15 +491,16 @@ func _draw():
MenuMode.SCORE_SCREEN:
GameTheme.set_screen_filter_alpha(score_screen_filter_alpha)
touch_rects[menu_mode] = _draw_score_screen(center)
ScoreText.show()
scoreText.show()
# var joypad_labels_pos = Vector2(32, 32)
# for i in len(joypad_labels):
# draw_string(titleFont, joypad_labels_pos, "Joypad #%02d: %s"%[i, joypad_labels[i]])
# joypad_labels_pos.y += 32
var joypad_labels_pos = Vector2(32, 32)
for i in len(joypad_labels):
draw_string(TitleFont, joypad_labels_pos, "Joypad #%02d: %s"%[i, joypad_labels[i]])
joypad_labels_pos.y += 32
func set_menu_mode(mode):
Receptors.fade(mode == MenuMode.GAMEPLAY)
receptors.fade(mode == MenuMode.GAMEPLAY)
if mode == MenuMode.GAMEPLAY:
PVMusic.stop()
rect_clip_content = false
@ -534,16 +540,16 @@ func touch_gameplay(touchdict):
if touchdict.has('action'):
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
if touchdict.action == 'stop':
NoteHandler.stop()
noteHandler.stop()
func touch_score_screen(touchdict):
if touchdict.has('next_menu'):
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
set_menu_mode(touchdict.next_menu)
ScoreText.score = ''
ScoreText.score_sub = ''
scoreText.score = ''
scoreText.score_sub = ''
# TODO: time this to coincide with the menu going fully offscreen
ScoreText.update()
scoreText.update()
elif touchdict.has('action'):
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
if touchdict.action == 'save':
@ -571,13 +577,13 @@ func _input(event):
if event is InputEventJoypadButton:
update_joypad_labels()
print_debug("Joypad #%02d is a '%s'" % [event.device, Input.get_joy_name(event.device)])
# print_debug("Joypad #%02d is a '%s'" % [event.device, Input.get_joy_name(event.device)])
# event.device
# event.button_index
# event.pressed
elif event is InputEventJoypadMotion:
update_joypad_labels()
print_debug("Joypad #%02d is a '%s'" % [event.device, Input.get_joy_name(event.device)])
# elif event is InputEventJoypadMotion:
# update_joypad_labels()
# print_debug("Joypad #%02d is a '%s'" % [event.device, Input.get_joy_name(event.device)])
# event.device
# event.axis
# event.axis_value

View File

@ -1,23 +1,23 @@
#tool
extends Control
export var NoteHandlerPath := @'../Center/NoteHandler'
export var ReceptorsPath := @'../Center/Receptors'
onready var NoteHandler := get_node(NoteHandlerPath)
onready var Receptors := get_node(ReceptorsPath)
onready var ScoreText := $ScoreText
export var noteHandlerPath := @'../Center/NoteHandler'
export var receptorsPath := @'../Center/Receptors'
onready var noteHandler := get_node(noteHandlerPath)
onready var receptors := get_node(receptorsPath)
onready var scoreText := $ScoreText
onready var PVMusic := SoundPlayer.music_player_pv
var f_scale := 1.0 setget set_f_scale
func set_f_scale(value: float) -> void:
f_scale = value
TitleFont.size = int(round(32*f_scale))
TitleFont.outline_size = int(max(round(2*f_scale), 1))
GenreFont.size = int(round(48*f_scale))
GenreFont.outline_size = int(max(round(2*f_scale), 1))
DiffNumFont.size = int(round(36*f_scale))
DiffNumFont.outline_size = int(max(round(1*f_scale), 1))
ScoreText.set_f_scale(f_scale)
titleFont.size = int(round(32*f_scale))
titleFont.outline_size = int(max(round(2*f_scale), 1))
genreFont.size = int(round(48*f_scale))
genreFont.outline_size = int(max(round(2*f_scale), 1))
diffNumFont.size = int(round(36*f_scale))
diffNumFont.outline_size = int(max(round(1*f_scale), 1))
scoreText.set_f_scale(f_scale)
func update_scale() -> void:
self.f_scale = rect_size.x/1080
@ -59,10 +59,10 @@ var scorescreen_saved := false
var touch_rects = []
var TitleFont: DynamicFont = preload('res://assets/MenuTitleFont.tres').duplicate()
var GenreFont: DynamicFont = preload('res://assets/MenuGenreFont.tres').duplicate()
var DiffNumFont: DynamicFont = preload('res://assets/MenuDiffNumberFont.tres').duplicate()
var ScoreFont: DynamicFont = preload('res://assets/MenuScoreFont.tres').duplicate()
var titleFont: DynamicFont = preload('res://assets/MenuTitleFont.tres').duplicate()
var genreFont: DynamicFont = preload('res://assets/MenuGenreFont.tres').duplicate()
var diffNumFont: DynamicFont = preload('res://assets/MenuDiffNumberFont.tres').duplicate()
var scoreFont: DynamicFont = preload('res://assets/MenuScoreFont.tres').duplicate()
var snd_interact := preload('res://assets/softclap.wav')
var snd_error := preload('res://assets/miss.wav')
@ -131,7 +131,7 @@ func load_preview():
func _ready():
scan_library()
connect('item_rect_changed', self, 'update_scale')
NoteHandler.connect('finished_song', self, 'finished_song')
noteHandler.connect('finished_song', self, 'finished_song')
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
@ -157,9 +157,9 @@ func _process(delta):
menu_mode_prev_fade_timer = max(0.0, menu_mode_prev_fade_timer - delta)
update()
if (menu_mode == MenuMode.GAMEPLAY) and (menu_mode_prev_fade_timer <= 0.0) and not NoteHandler.running:
NoteHandler.load_track(self.selected_song_key, Library.Song.default_difficulty_keys[selected_difficulty])
NoteHandler.running = true
if (menu_mode == MenuMode.GAMEPLAY) and (menu_mode_prev_fade_timer <= 0.0) and not noteHandler.running:
noteHandler.load_track(self.selected_song_key, Library.Song.default_difficulty_keys[selected_difficulty])
noteHandler.running = true
func draw_string_centered(font: Font, position: Vector2, string: String, color := GameTheme.COLOR_MENU_TEXT, vcenter := false) -> Vector2:
@ -194,11 +194,11 @@ func draw_songtile(song_key, position, size, title_text:=false, difficulty=selec
draw_rect(Rect2(position.x - outline_px, position.y - outline_px, size + outline_px*2, size + outline_px*2), diff_color)
draw_texture_rect(Library.get_song_tile_texture(song_key), rect, false, Color.white if not disabled else Color(0.5, 0.2, 0.1))
# Draw track difficulty rating
draw_string_ralign(DiffNumFont, position+Vector2(size-2*f_scale, size-5*f_scale), song_diffs.get(Library.Song.default_difficulty_keys[difficulty], '0'), diff_color)
draw_string_ralign(diffNumFont, position+Vector2(size-2*f_scale, size-5*f_scale), song_diffs.get(Library.Song.default_difficulty_keys[difficulty], '0'), diff_color)
if disabled:
draw_string_centered(DiffNumFont, position+Vector2(size/2, size/2), 'No Chart!', diff_color, true)
draw_string_centered(diffNumFont, position+Vector2(size/2, size/2), 'No Chart!', diff_color, true)
if title_text:
draw_string_centered(TitleFont, position+Vector2(size/2.0, size+40*f_scale), str(Library.all_songs[song_key].title), diff_color.lightened(0.33))
draw_string_centered(titleFont, position+Vector2(size/2.0, size+40*f_scale), str(Library.all_songs[song_key].title), diff_color.lightened(0.33))
return rect
func diff_f2str(difficulty: float): # Convert .5 to +
@ -215,8 +215,8 @@ func _draw_song_select(center: Vector2) -> Array:
var touchrects := []
if len(genres) <= 0:
draw_string_centered(GenreFont, Vector2(center.x, center.y-440*f_scale), 'No Songs in Library!', Color.aqua)
draw_string_centered(DiffNumFont, Vector2(center.x, center.y-390*f_scale), FileLoader.userroot, Color.lightgreen)
draw_string_centered(genreFont, Vector2(center.x, center.y-440*f_scale), 'No Songs in Library!', Color.aqua)
draw_string_centered(diffNumFont, Vector2(center.x, center.y-390*f_scale), FileLoader.userroot, Color.lightgreen)
return touchrects
var ssid = self.selected_song_idx
@ -230,7 +230,7 @@ func _draw_song_select(center: Vector2) -> Array:
var gx = center.x - (subsize + spacer_x) * s_delta
var songslist = Library.genre_songs[g].keys()
var genre_str = '%s (%d songs)'%[genres.keys()[g], len(songslist)]
draw_string_centered(GenreFont, Vector2(center.x, gy), genre_str, Color.lightblue)
draw_string_centered(genreFont, Vector2(center.x, gy), genre_str, Color.lightblue)
var s = len(songslist)
var key = songslist[self.selected_song_idx % s]
@ -263,8 +263,8 @@ func _draw_song_select(center: Vector2) -> Array:
var cs = PoolColorArray([Color(0,0,0.1,1.25), Color(0,0,0.1,1.25), Color(0,0,0,0), Color(0,0,0,0)])
draw_polygon(ps, cs)
draw_polygon(ps2, cs)
draw_string_centered(GenreFont, Vector2(center.x, center.y-440*f_scale), 'Select Song', Color.aqua)
draw_string_centered(DiffNumFont, Vector2(center.x, center.y-390*f_scale), 'Tap to scroll, tap focused to select', Color.lightgreen)
draw_string_centered(genreFont, Vector2(center.x, center.y-440*f_scale), 'Select Song', Color.aqua)
draw_string_centered(diffNumFont, Vector2(center.x, center.y-390*f_scale), 'Tap to scroll, tap focused to select', Color.lightgreen)
return touchrects
func _draw_chart_select(center: Vector2) -> Array:
@ -277,9 +277,9 @@ func _draw_chart_select(center: Vector2) -> Array:
var size = min(192, (1000-spacer_x*(n-1))/n) * f_scale
var rect_back = Rect2(center + Vector2(-300.0, 390.0)*f_scale, Vector2(600.0, 140.0)*f_scale)
draw_rect(rect_back, Color.red)
draw_string_centered(TitleFont, get_rect_center(rect_back), 'Back to song selection', Color.white, true)
draw_string_centered(GenreFont, center+Vector2(0, -360*f_scale), 'Select Difficulty', Color.aqua)
draw_string_centered(DiffNumFont, center+Vector2(0, -300*f_scale), 'Tap to show stats, tap focused to play', Color.lightgreen)
draw_string_centered(titleFont, get_rect_center(rect_back), 'Back to song selection', Color.white, true)
draw_string_centered(genreFont, center+Vector2(0, -360*f_scale), 'Select Difficulty', Color.aqua)
draw_string_centered(diffNumFont, center+Vector2(0, -300*f_scale), 'Tap to show stats, tap focused to play', Color.lightgreen)
var touchrects = [{rect=rect_back, chart_idx=-1, enabled=true}] # invisible back button
var x = center.x - (size*n + spacer_x*(n-1))/2
@ -290,10 +290,10 @@ func _draw_chart_select(center: Vector2) -> Array:
var r = draw_songtile(self.selected_song_key, Vector2(x, center.y-160*f_scale), size, false, i_diff, width, not chart_exists)
touchrects.append({rect=r, chart_idx=i_diff, enabled=chart_exists})
x += size + spacer_x
draw_string_centered(TitleFont, center+Vector2(0, size-116*f_scale), str(Library.all_songs[self.selected_song_key].title))
draw_string_centered(titleFont, center+Vector2(0, size-116*f_scale), str(Library.all_songs[self.selected_song_key].title))
draw_string_centered(TitleFont, center+Vector2(-50*f_scale, size-64*f_scale), 'BPM:')
draw_string_centered(TitleFont, center+Vector2(+50*f_scale, size-64*f_scale), str(song_data.BPM))
draw_string_centered(titleFont, center+Vector2(-50*f_scale, size-64*f_scale), 'BPM:')
draw_string_centered(titleFont, center+Vector2(+50*f_scale, size-64*f_scale), str(song_data.BPM))
if len(charts) > 0:
var sel_chart: Array = charts.values()[min(selected_difficulty, len(charts)-1)]
@ -304,10 +304,10 @@ func _draw_chart_select(center: Vector2) -> Array:
var notetypes = [0, 1, 2]
var note_counts = [meta.num_taps, meta.num_holds, meta.num_slides]
for i in len(notestrs):
draw_string_centered(TitleFont, center+Vector2(-50*f_scale, size+(12+i*50)*f_scale), notestrs[i])
draw_string_centered(TitleFont, center+Vector2(+50*f_scale, size+(12+i*50)*f_scale), str(note_counts[notetypes[i]]))
draw_string_centered(titleFont, center+Vector2(-50*f_scale, size+(12+i*50)*f_scale), notestrs[i])
draw_string_centered(titleFont, center+Vector2(+50*f_scale, size+(12+i*50)*f_scale), str(note_counts[notetypes[i]]))
else:
draw_string_centered(TitleFont, center+Vector2(0, size-12*f_scale), 'No available charts!', Color.red)
draw_string_centered(titleFont, center+Vector2(0, size-12*f_scale), 'No available charts!', Color.red)
return touchrects
@ -337,7 +337,7 @@ func _draw_score_screen(center: Vector2) -> Array:
var judgement_text_size = Vector2(256, 64) * judgement_text_scale
draw_songtile(song_key, center + Vector2.LEFT*size*0.5 + Vector2(-x_score, y_score)*f_scale, size, false, selected_difficulty, 3)
draw_string_centered(TitleFont, center + Vector2.DOWN*size + Vector2(-x_score, y_score+48)*f_scale, str(Library.all_songs[song_key].title))
draw_string_centered(titleFont, center + Vector2.DOWN*size + Vector2(-x_score, y_score+48)*f_scale, str(Library.all_songs[song_key].title))
var notestrs = ['Taps (%d):'%meta.num_taps, 'Holds (%d) Hit:'%meta.num_holds, 'Released:', 'Stars (%d):'%meta.num_slides, 'Slides:']
var notetypes = [0, 1, -1, 2, -2]
var note_spacing = [0.0, 1.25, 2.25, 3.5, 4.5]
@ -352,10 +352,10 @@ func _draw_score_screen(center: Vector2) -> Array:
for i in len(judgestrs):
# For each judgement type, print a column header
# draw_string_centered(TitleFont, Vector2(x2+x_spacing*(i+1), y2), judgestrs[i])
# draw_string_centered(titleFont, Vector2(x2+x_spacing*(i+1), y2), judgestrs[i])
var dst_rect = Rect2(center+Vector2(x2+x_spacing*(i+1)-judgement_text_size.x*f_scale/2.0, y2), judgement_text_size*f_scale)
draw_texture_rect_region(tex_judgement_text, dst_rect, Rect2(0, 128*(i+3), 512, 128))
draw_string_centered(TitleFont, center+Vector2(x2+x_spacing*(len(judgestrs)+1), y2+34*f_scale), 'Score')
draw_string_centered(titleFont, center+Vector2(x2+x_spacing*(len(judgestrs)+1), y2+34*f_scale), 'Score')
for i in len(notestrs):
# For each note type, make a row and print scores
@ -363,7 +363,7 @@ func _draw_score_screen(center: Vector2) -> Array:
var note_score = 0
var note_count = 0
var y_row = y3 + y_spacing * (note_spacing[i]+1)
draw_string_centered(TitleFont, center+Vector2(x2-20*f_scale, y_row), notestrs[i])
draw_string_centered(titleFont, center+Vector2(x2-20*f_scale, y_row), notestrs[i])
for j in len(judgestrs):
var score
if j == 0:
@ -375,13 +375,13 @@ func _draw_score_screen(center: Vector2) -> Array:
notecount_early += scorescreen_score_data[idx][-j]
notecount_late += scorescreen_score_data[idx][j]
if (j >= len(judgestrs)-1) and (idx == -1):
draw_string_centered(TitleFont, center+Vector2(x2+x_spacing*(j+1), y_row), '^')
draw_string_centered(titleFont, center+Vector2(x2+x_spacing*(j+1), y_row), '^')
else:
draw_string_centered(TitleFont, center+Vector2(x2+x_spacing*(j+1), y_row), str(score))
draw_string_centered(titleFont, center+Vector2(x2+x_spacing*(j+1), y_row), str(score))
notecount_total += score # Kinda redundant, will probably refactor eventually
note_count += score
note_score += score * judge_scores[j]
draw_string_centered(TitleFont, center+Vector2(x2+x_spacing*(len(judgestrs)+1), y_row), '%2.2f%%'%(note_score/max(note_count, 1)*100.0))
draw_string_centered(titleFont, center+Vector2(x2+x_spacing*(len(judgestrs)+1), y_row), '%2.2f%%'%(note_score/max(note_count, 1)*100.0))
total_score += note_score * notetype_weights[i]
total_scoremax += note_count * notetype_weights[i]
@ -392,31 +392,31 @@ func _draw_score_screen(center: Vector2) -> Array:
break
else:
score_idx += 1
ScoreText.position = center+Vector2(x_score, y_score)*f_scale
ScoreText.score = Rules.SCORE_STRINGS[score_idx]
ScoreText.score_sub = '%2.3f%%'%(overall_score*100.0)
ScoreText.update()
scoreText.position = center+Vector2(x_score, y_score)*f_scale
scoreText.score = Rules.SCORE_STRINGS[score_idx]
scoreText.score_sub = '%2.3f%%'%(overall_score*100.0)
scoreText.update()
draw_string_centered(TitleFont, center+Vector2(-150, y3+y_spacing*7), 'Early : Late')
draw_string_centered(TitleFont, center+Vector2(-150, y3+y_spacing*8), '%3d%% : %3d%%'%[notecount_early*100/max(notecount_total, 1), notecount_late*100/max(notecount_total, 1)])
draw_string_centered(TitleFont, center+Vector2(150, y3+y_spacing*7.5), 'Max Combo: %d'%scorescreen_score_data.get('max_combo', 0)) # Safety for older saves
draw_string_centered(titleFont, center+Vector2(-150, y3+y_spacing*7), 'Early : Late')
draw_string_centered(titleFont, center+Vector2(-150, y3+y_spacing*8), '%3d%% : %3d%%'%[notecount_early*100/max(notecount_total, 1), notecount_late*100/max(notecount_total, 1)])
draw_string_centered(titleFont, center+Vector2(150, y3+y_spacing*7.5), 'Max Combo: %d'%scorescreen_score_data.get('max_combo', 0)) # Safety for older saves
var txt_offset = Vector2.DOWN*10*f_scale
var rect_songs := Rect2(center+Vector2(-100.0, 300.0)*f_scale, Vector2(400.0, 100.0)*f_scale)
draw_rect(rect_songs, Color.red)
draw_string_centered(TitleFont, get_rect_center(rect_songs), 'Song Select', Color.white, true)
draw_string_centered(titleFont, get_rect_center(rect_songs), 'Song Select', Color.white, true)
touchrects.append({rect=rect_songs, next_menu=MenuMode.SONG_SELECT})
var rect_save := Rect2(center+Vector2(-300.0, 300.0)*f_scale, Vector2(180.0, 100.0)*f_scale)
if not scorescreen_saved:
draw_rect(rect_save, Color(0.0, 0.01, 1.0))
draw_string_centered(TitleFont, get_rect_center(rect_save), 'Save', Color.white, true)
draw_string_centered(titleFont, get_rect_center(rect_save), 'Save', Color.white, true)
touchrects.append({rect=rect_save, action='save'})
else:
draw_rect(rect_save, Color.darkgray)
draw_string_centered(TitleFont, get_rect_center(rect_save), 'Saved', Color.white, true)
draw_string_centered(titleFont, get_rect_center(rect_save), 'Saved', Color.white, true)
draw_string_centered(GenreFont, center+Vector2.UP*410*f_scale, 'Results', Color.aqua)
draw_string_centered(genreFont, center+Vector2.UP*410*f_scale, 'Results', Color.aqua)
return touchrects
func _draw_gameplay(center: Vector2) -> Array:
@ -424,7 +424,7 @@ func _draw_gameplay(center: Vector2) -> Array:
var rect_songselect := Rect2(center+Vector2(+860.0, 480.0)*f_scale, Vector2(100.0, 50.0)*f_scale)
draw_rect(rect_songselect, Color.red)
draw_string_centered(TitleFont, get_rect_center(rect_songselect), 'Stop', Color.white, true)
draw_string_centered(titleFont, get_rect_center(rect_songselect), 'Stop', Color.white, true)
touchrects.append({rect=rect_songselect, action='stop'})
return touchrects
@ -436,7 +436,7 @@ func _draw():
var outline_px = 3
var center = rect_size * 0.5
touch_rects = []
ScoreText.hide()
scoreText.hide()
for i in MenuMode:
touch_rects.append([])
@ -466,7 +466,7 @@ func _draw():
GameTheme.set_screen_filter_alpha(1.0 - progress)
MenuMode.SCORE_SCREEN:
_draw_score_screen(center_next)
ScoreText.show()
scoreText.show()
else:
match menu_mode:
MenuMode.SONG_SELECT:
@ -483,10 +483,10 @@ func _draw():
MenuMode.SCORE_SCREEN:
GameTheme.set_screen_filter_alpha(score_screen_filter_alpha)
touch_rects[menu_mode] = _draw_score_screen(center)
ScoreText.show()
scoreText.show()
func set_menu_mode(mode):
Receptors.fade(mode == MenuMode.GAMEPLAY)
receptors.fade(mode == MenuMode.GAMEPLAY)
if mode == MenuMode.GAMEPLAY:
PVMusic.stop()
rect_clip_content = false
@ -529,16 +529,16 @@ func touch_gameplay(touchdict):
if touchdict.has('action'):
play_sound(snd_interact)
if touchdict.action == 'stop':
NoteHandler.stop()
noteHandler.stop()
func touch_score_screen(touchdict):
if touchdict.has('next_menu'):
play_sound(snd_interact)
set_menu_mode(touchdict.next_menu)
ScoreText.score = ''
ScoreText.score_sub = ''
scoreText.score = ''
scoreText.score_sub = ''
# TODO: time this to coincide with the menu going fully offscreen
ScoreText.update()
scoreText.update()
elif touchdict.has('action'):
play_sound(snd_interact)
if touchdict.action == 'save':