Menu text refactor

This commit is contained in:
Luke Hubmayer-Werner 2020-12-30 10:27:14 +10:30
parent 68dc0199c1
commit 10bb94bc15
3 changed files with 25 additions and 23 deletions

View File

@ -87,6 +87,8 @@ const UV_ARRAY_D_ROLL := PoolVector2Array([
])
# Color definitions
const COLOR_MENU_TEXT = Color(0.95, 0.95, 1.0)
const COLOR_TAP := Color(1, 0.15, 0.15, 1)
const COLOR_TAP2 := Color(0.75, 0.5, 0, 1) # High-score taps ("breaks" in maimai)
const COLOR_HOLD := Color(1, 0.15, 0.15, 1)

View File

@ -95,7 +95,7 @@ func _process(delta):
NoteHandler.load_track(song_key, Library.Song.default_difficulty_keys[selected_difficulty])
NoteHandler.running = true
func draw_string_centered(font, position, string, color := Color.white):
func draw_string_centered(font, position, string, color := GameTheme.COLOR_MENU_TEXT):
draw_string(font, Vector2(position.x - font.get_string_size(string).x/2.0, position.y + font.get_ascent()), string, color)
func draw_songtile(song_key, position, size, title_text:=false, difficulty=selected_difficulty, outline_px:=3):
@ -191,21 +191,21 @@ func _draw_chart_select(center: Vector2) -> Array:
var r = draw_songtile(selected_song_key, Vector2(x, center.y), size, false, i_diff, width)
touchrects.append({rect=r, chart_idx=i_diff})
x += size + spacer_x
draw_string_centered(TitleFont, Vector2(center.x, center.y+size+32), Library.all_songs[selected_song_key].title.n, Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(center.x, center.y+size+32), Library.all_songs[selected_song_key].title.n)
var sel_chart: Array = charts.values()[min(selected_difficulty, len(charts)-1)]
var all_notes: Array = sel_chart[1]
var meta: Dictionary = sel_chart[0]
draw_string_centered(TitleFont, Vector2(center.x-50, center.y+size+80), 'BPM:', Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(center.x+50, center.y+size+80), str(song_data.BPM), Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(center.x-50, center.y+size+80), 'BPM:')
draw_string_centered(TitleFont, Vector2(center.x+50, center.y+size+80), str(song_data.BPM))
var notestrs = ['Taps:', 'Holds:', 'Slides:']
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, Vector2(center.x-50, center.y+size+148+i*50), notestrs[i], Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(center.x+50, center.y+size+148+i*50), str(note_counts[notetypes[i]]), Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(center.x-50, center.y+size+148+i*50), notestrs[i])
draw_string_centered(TitleFont, Vector2(center.x+50, center.y+size+148+i*50), str(note_counts[notetypes[i]]))
return touchrects
@ -236,7 +236,7 @@ func _draw_score_screen(center: Vector2) -> Array:
var judgement_text_height = 64 * judgement_text_scale
draw_songtile(song_key, Vector2(x_songtile-size/2.0, y), size, false, selected_difficulty, 3)
draw_string_centered(TitleFont, Vector2(x_songtile, y+size), Library.all_songs[song_key].title.n, Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(x_songtile, y+size), Library.all_songs[song_key].title.n)
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]
@ -251,9 +251,9 @@ 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], Color(0.95, 0.95, 1.0))
# draw_string_centered(TitleFont, Vector2(x2+x_spacing*(i+1), y2), judgestrs[i])
draw_texture_rect_region(tex_judgement_text, Rect2(x2+x_spacing*(i+1)-judgement_text_width/2.0, y2, judgement_text_width, judgement_text_height), Rect2(0, 128*(i+3), 512, 128))
draw_string_centered(TitleFont, Vector2(x2+x_spacing*(len(judgestrs)+1), y2), 'Score', Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(x2+x_spacing*(len(judgestrs)+1), y2-4), 'Score')
for i in len(notestrs):
# For each note type, make a row and print scores
@ -262,7 +262,7 @@ func _draw_score_screen(center: Vector2) -> Array:
var note_count = 0
# var y_row = y2+y_spacing*(i+1)
var y_row = y2 + y_spacing * (note_spacing[i]+1)
draw_string_centered(TitleFont, Vector2(x2-20, y_row), notestrs[i], Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(x2-20, y_row), notestrs[i])
for j in len(judgestrs):
var score
if j == 0:
@ -274,13 +274,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, Vector2(x2+x_spacing*(j+1), y_row), '^', Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(x2+x_spacing*(j+1), y_row), '^')
else:
draw_string_centered(TitleFont, Vector2(x2+x_spacing*(j+1), y_row), str(score), Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, 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, Vector2(x2+x_spacing*(len(judgestrs)+1), y_row), '%2.2f%%'%(note_score/max(note_count, 1)*100.0), Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, 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]
@ -291,29 +291,29 @@ func _draw_score_screen(center: Vector2) -> Array:
break
else:
score_idx += 1
# draw_string_centered(ScoreFont, Vector2(x_score, y1), Rules.SCORE_STRINGS[score_idx], Color(1.0, 1.0, 1.0))
# draw_string_centered(TitleFont, Vector2(x_score, y1+y_spacing*3), '%2.3f%%'%(overall_score*100.0), Color(1.0, 1.0, 1.0))
# draw_string_centered(ScoreFont, Vector2(x_score, y1), Rules.SCORE_STRINGS[score_idx], Color.white)
# draw_string_centered(TitleFont, Vector2(x_score, y1+y_spacing*3), '%2.3f%%'%(overall_score*100.0), Color.white)
ScoreText.position = Vector2(x_score, y1)
ScoreText.score = Rules.SCORE_STRINGS[score_idx]
ScoreText.score_sub = '%2.3f%%'%(overall_score*100.0)
ScoreText.update()
draw_string_centered(TitleFont, Vector2(x, y2+y_spacing*7), 'Early : Late', Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(x, y2+y_spacing*8), '%3d%% : %3d%%'%[notecount_early*100/notecount_total, notecount_late*100/notecount_total], Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(x, y2+y_spacing*7), 'Early : Late')
draw_string_centered(TitleFont, Vector2(x, y2+y_spacing*8), '%3d%% : %3d%%'%[notecount_early*100/notecount_total, notecount_late*100/notecount_total])
var rect_songselect := Rect2(x-100.0, y+660.0, 400.0, 100.0)
draw_rect(rect_songselect, Color.red)
draw_string_centered(TitleFont, Vector2(x+100, y+680), 'Song Select', Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(x+100, y+680), 'Song Select')
touchrects.append({rect=rect_songselect, next_menu=MenuMode.SONG_SELECT})
var rect_save := Rect2(x-300.0, y+660.0, 180.0, 100.0)
if not scorescreen_saved:
draw_rect(rect_save, Color(0.0, 0.01, 1.0))
draw_string_centered(TitleFont, Vector2(x-210, y+680), 'Save', Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(x-210, y+680), 'Save')
touchrects.append({rect=rect_save, action='save'})
else:
draw_rect(rect_save, Color.darkgray)
draw_string_centered(TitleFont, Vector2(x-210, y+680), 'Saved', Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, Vector2(x-210, y+680), 'Saved')
return touchrects
func _draw_gameplay(center: Vector2) -> Array:
@ -323,7 +323,7 @@ func _draw_gameplay(center: Vector2) -> Array:
var rect_songselect := Rect2(x-960.0, y+440.0, 100.0, 100.0)
draw_rect(rect_songselect, Color.red)
draw_string_centered(TitleFont, center+Vector2(-910, 470), 'Stop', Color(0.95, 0.95, 1.0))
draw_string_centered(TitleFont, center+Vector2(-910, 470), 'Stop')
touchrects.append({rect=rect_songselect, action='stop'})
return touchrects

View File

@ -11,6 +11,6 @@ func draw_string_centered(font, position, string, color := Color.white):
func _draw():
if score:
draw_string_centered(ScoreFont, Vector2(0, 0), score, Color(1.0, 1.0, 1.0))
draw_string_centered(ScoreFont, Vector2(0, 0), score)
if score_sub:
draw_string_centered(TitleFont, Vector2(0, 128), score_sub, Color(1.0, 1.0, 1.0))
draw_string_centered(TitleFont, Vector2(0, 128), score_sub)