mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
make some enums
This commit is contained in:
@@ -12,7 +12,7 @@ from libs.animation import Animation
|
||||
from libs.audio import audio
|
||||
from libs.background import Background
|
||||
from libs.chara_2d import Chara2D
|
||||
from libs.global_data import Modifiers
|
||||
from libs.global_data import Crown, Difficulty, Modifiers
|
||||
from libs.global_objects import AllNetIcon, Nameplate
|
||||
from libs.screen import Screen
|
||||
from libs.texture import tex
|
||||
@@ -21,6 +21,7 @@ from libs.tja import (
|
||||
Drumroll,
|
||||
Note,
|
||||
NoteList,
|
||||
NoteType,
|
||||
TJAParser,
|
||||
apply_modifiers,
|
||||
calculate_base_score,
|
||||
@@ -168,13 +169,13 @@ class GameScreen(Screen):
|
||||
result = cursor.fetchone()
|
||||
existing_score = result[0] if result is not None else None
|
||||
existing_crown = result[1] if result is not None and len(result) > 1 and result[1] is not None else 0
|
||||
crown = 0
|
||||
crown = Crown.NONE
|
||||
if session_data.result_data.bad and session_data.result_data.ok == 0:
|
||||
crown = 3
|
||||
crown = Crown.DFC
|
||||
elif session_data.result_data.bad == 0:
|
||||
crown = 2
|
||||
crown = Crown.FC
|
||||
elif self.player_1.gauge.is_clear:
|
||||
crown = 1
|
||||
crown = Crown.CLEAR
|
||||
logger.info(f"Existing score: {existing_score}, Existing crown: {existing_crown}, New score: {session_data.result_data.score}, New crown: {crown}")
|
||||
if result is None or (existing_score is not None and session_data.result_data.score > existing_score):
|
||||
insert_query = '''
|
||||
@@ -383,9 +384,9 @@ class Player:
|
||||
if section.play_notes:
|
||||
self.end_time = max(self.end_time, section.play_notes[-1].hit_ms)
|
||||
|
||||
self.don_notes = deque([note for note in self.play_notes if note.type in {1, 3}])
|
||||
self.kat_notes = deque([note for note in self.play_notes if note.type in {2, 4}])
|
||||
self.other_notes = deque([note for note in self.play_notes if note.type not in {1, 2, 3, 4}])
|
||||
self.don_notes = deque([note for note in self.play_notes if note.type in {NoteType.DON, NoteType.DON_L}])
|
||||
self.kat_notes = deque([note for note in self.play_notes if note.type in {NoteType.KAT, NoteType.KAT_L}])
|
||||
self.other_notes = deque([note for note in self.play_notes if note.type not in {NoteType.DON, NoteType.DON_L, NoteType.KAT, NoteType.KAT_L}])
|
||||
self.total_notes = len([note for note in self.play_notes if 0 < note.type < 5])
|
||||
total_notes = notes
|
||||
if self.branch_m:
|
||||
@@ -416,9 +417,9 @@ class Player:
|
||||
self.play_notes = deque(sorted(self.play_notes))
|
||||
self.draw_note_list = deque(sorted(self.draw_note_list, key=lambda x: x.load_ms))
|
||||
self.draw_bar_list = deque(sorted(self.draw_bar_list, key=lambda x: x.load_ms))
|
||||
total_don = [note for note in self.play_notes if note.type in {1, 3}]
|
||||
total_kat = [note for note in self.play_notes if note.type in {2, 4}]
|
||||
total_other = [note for note in self.play_notes if note.type not in {1, 2, 3, 4}]
|
||||
total_don = [note for note in self.play_notes if note.type in {NoteType.DON, NoteType.DON_L}]
|
||||
total_kat = [note for note in self.play_notes if note.type in {NoteType.KAT, NoteType.KAT_L}]
|
||||
total_other = [note for note in self.play_notes if note.type not in {NoteType.DON, NoteType.DON_L, NoteType.KAT, NoteType.KAT_L}]
|
||||
|
||||
self.don_notes = deque([note for note in total_don if note.hit_ms > current_ms])
|
||||
self.kat_notes = deque([note for note in total_kat if note.hit_ms > current_ms])
|
||||
@@ -493,7 +494,7 @@ class Player:
|
||||
end_roll = -1
|
||||
for notes in note_lists:
|
||||
for i in range(len(notes)-1, -1, -1):
|
||||
if notes[i].type == 8 and notes[i].hit_ms <= end_time:
|
||||
if notes[i].type == NoteType.TAIL and notes[i].hit_ms <= end_time:
|
||||
end_roll = notes[i].hit_ms
|
||||
break
|
||||
if end_roll != -1:
|
||||
@@ -555,11 +556,11 @@ class Player:
|
||||
|
||||
note = self.other_notes[0]
|
||||
if (note.hit_ms <= current_ms):
|
||||
if note.type == 5 or note.type == 6:
|
||||
if note.type == NoteType.ROLL_HEAD or note.type == NoteType.ROLL_HEAD_L:
|
||||
self.is_drumroll = True
|
||||
elif note.type == 7 or note.type == 9:
|
||||
elif note.type == NoteType.BALLOON_HEAD or note.type == NoteType.KUSUDAMA:
|
||||
self.is_balloon = True
|
||||
elif note.type == 8:
|
||||
elif note.type == NoteType.TAIL:
|
||||
self.other_notes.popleft()
|
||||
self.is_drumroll = False
|
||||
self.is_balloon = False
|
||||
@@ -582,7 +583,7 @@ class Player:
|
||||
if 5 <= current_note.type <= 7:
|
||||
bisect.insort_left(self.current_notes_draw, current_note, key=lambda x: x.index)
|
||||
try:
|
||||
tail_note = next((note for note in self.draw_note_list if note.type == 8))
|
||||
tail_note = next((note for note in self.draw_note_list if note.type == NoteType.TAIL))
|
||||
bisect.insort_left(self.current_notes_draw, tail_note, key=lambda x: x.index)
|
||||
self.draw_note_list.remove(tail_note)
|
||||
except Exception as e:
|
||||
@@ -597,7 +598,7 @@ class Player:
|
||||
self.current_notes_draw[0].color += 1
|
||||
|
||||
note = self.current_notes_draw[0]
|
||||
if note.type in {5, 6, 7, 9} and len(self.current_notes_draw) > 1:
|
||||
if note.type in {NoteType.ROLL_HEAD, NoteType.ROLL_HEAD_L, NoteType.BALLOON_HEAD, NoteType.KUSUDAMA} and len(self.current_notes_draw) > 1:
|
||||
note = self.current_notes_draw[1]
|
||||
position = self.get_position_x(SCREEN_WIDTH, current_ms, note.hit_ms, note.pixels_per_frame_x)
|
||||
if position < GameScreen.JUDGE_X + 650:
|
||||
@@ -610,15 +611,15 @@ class Player:
|
||||
|
||||
def note_correct(self, note: Note, current_time: float):
|
||||
"""Removes a note from the appropriate separated list"""
|
||||
if note.type in {1, 3} and self.don_notes and self.don_notes[0] == note:
|
||||
if note.type in {NoteType.DON, NoteType.DON_L} and self.don_notes and self.don_notes[0] == note:
|
||||
self.don_notes.popleft()
|
||||
elif note.type in {2, 4} and self.kat_notes and self.kat_notes[0] == note:
|
||||
elif note.type in {NoteType.KAT, NoteType.KAT_L} and self.kat_notes and self.kat_notes[0] == note:
|
||||
self.kat_notes.popleft()
|
||||
elif note.type not in {1, 2, 3, 4} and self.other_notes and self.other_notes[0] == note:
|
||||
elif note.type not in {NoteType.DON, NoteType.DON_L, NoteType.KAT, NoteType.KAT_L} and self.other_notes and self.other_notes[0] == note:
|
||||
self.other_notes.popleft()
|
||||
|
||||
index = note.index
|
||||
if note.type == 7:
|
||||
if note.type == NoteType.BALLOON_HEAD:
|
||||
if self.other_notes:
|
||||
self.other_notes.popleft()
|
||||
|
||||
@@ -631,8 +632,8 @@ class Player:
|
||||
if self.combo > self.max_combo:
|
||||
self.max_combo = self.combo
|
||||
|
||||
if note.type != 9:
|
||||
self.draw_arc_list.append(NoteArc(note.type, current_time, self.is_2p + 1, note.type == 3 or note.type == 4 or note.type == 7, note.type == 7))
|
||||
if note.type != NoteType.KUSUDAMA:
|
||||
self.draw_arc_list.append(NoteArc(note.type, current_time, self.is_2p + 1, note.type == NoteType.DON_L or note.type == NoteType.KAT_L or note.type == NoteType.BALLOON_HEAD, note.type == NoteType.BALLOON_HEAD))
|
||||
|
||||
if note in self.current_notes_draw:
|
||||
index = self.current_notes_draw.index(note)
|
||||
@@ -693,7 +694,7 @@ class Player:
|
||||
if len(self.don_notes) == 0 and len(self.kat_notes) == 0 and len(self.other_notes) == 0:
|
||||
return
|
||||
|
||||
if self.difficulty < 2:
|
||||
if self.difficulty < Difficulty.NORMAL:
|
||||
good_window_ms = Player.TIMING_GOOD_EASY
|
||||
ok_window_ms = Player.TIMING_OK_EASY
|
||||
bad_window_ms = Player.TIMING_BAD_EASY
|
||||
@@ -727,7 +728,7 @@ class Player:
|
||||
if ms_from_start > (curr_note.hit_ms + bad_window_ms):
|
||||
return
|
||||
|
||||
big = curr_note.type == 3 or curr_note.type == 4
|
||||
big = curr_note.type == NoteType.DON_L or curr_note.type == NoteType.KAT_L
|
||||
if (curr_note.hit_ms - good_window_ms) <= ms_from_start <= (curr_note.hit_ms + good_window_ms):
|
||||
self.draw_judge_list.append(Judgement('GOOD', big, self.is_2p))
|
||||
self.lane_hit_effect = LaneHitEffect('GOOD', self.is_2p)
|
||||
@@ -846,7 +847,7 @@ class Player:
|
||||
self.autoplay_hit_side = 'R' if self.autoplay_hit_side == 'L' else 'L'
|
||||
self.spawn_hit_effects(hit_type, self.autoplay_hit_side)
|
||||
audio.play_sound(f'hitsound_don_{self.player_number}p', 'hitsound')
|
||||
note_type = 3 if note.type == 6 else 1
|
||||
note_type = NoteType.DON_L if note.type == NoteType.ROLL_HEAD_L else NoteType.DON
|
||||
self.check_note(ms_from_start, note_type, current_time, background)
|
||||
else:
|
||||
# Handle DON notes
|
||||
@@ -971,8 +972,8 @@ class Player:
|
||||
def draw_drumroll(self, current_ms: float, head: Drumroll, current_eighth: int):
|
||||
"""Draws a drumroll in the player's lane"""
|
||||
start_position = self.get_position_x(SCREEN_WIDTH, current_ms, head.load_ms, head.pixels_per_frame_x)
|
||||
tail = next((note for note in self.current_notes_draw[1:] if note.type == 8 and note.index > head.index), self.current_notes_draw[1])
|
||||
is_big = int(head.type == 6)
|
||||
tail = next((note for note in self.current_notes_draw[1:] if note.type == NoteType.TAIL and note.index > head.index), self.current_notes_draw[1])
|
||||
is_big = int(head.type == NoteType.ROLL_HEAD_L)
|
||||
end_position = self.get_position_x(SCREEN_WIDTH, current_ms, tail.load_ms, tail.pixels_per_frame_x)
|
||||
length = end_position - start_position
|
||||
color = ray.Color(255, head.color, head.color, 255)
|
||||
@@ -993,7 +994,7 @@ class Player:
|
||||
"""Draws a balloon in the player's lane"""
|
||||
offset = 12
|
||||
start_position = self.get_position_x(SCREEN_WIDTH, current_ms, head.load_ms, head.pixels_per_frame_x)
|
||||
tail = next((note for note in self.current_notes_draw[1:] if note.type == 8 and note.index > head.index), self.current_notes_draw[1])
|
||||
tail = next((note for note in self.current_notes_draw[1:] if note.type == NoteType.TAIL and note.index > head.index), self.current_notes_draw[1])
|
||||
end_position = self.get_position_x(SCREEN_WIDTH, current_ms, tail.load_ms, tail.pixels_per_frame_x)
|
||||
pause_position = 349
|
||||
if current_ms >= tail.hit_ms:
|
||||
@@ -1041,7 +1042,7 @@ class Player:
|
||||
for note in reversed(self.current_notes_draw):
|
||||
if self.balloon_anim is not None and note == self.current_notes_draw[0]:
|
||||
continue
|
||||
if note.type == 8:
|
||||
if note.type == NoteType.TAIL:
|
||||
continue
|
||||
|
||||
if isinstance(note, Drumroll):
|
||||
@@ -2193,16 +2194,16 @@ class Gauge:
|
||||
self.gauge_length = 0
|
||||
self.previous_length = 0
|
||||
self.total_notes = total_notes
|
||||
self.difficulty = min(3, difficulty)
|
||||
self.difficulty = min(Difficulty.ONI, difficulty)
|
||||
self.clear_start = [52, 60, 69, 69]
|
||||
self.gauge_max = 87
|
||||
self.level = min(10, level)
|
||||
self.tamashii_fire_change = tex.get_animation(25)
|
||||
if self.difficulty == 2:
|
||||
if self.difficulty == Difficulty.HARD:
|
||||
self.string_diff = "_hard"
|
||||
elif self.difficulty == 1:
|
||||
elif self.difficulty == Difficulty.NORMAL:
|
||||
self.string_diff = "_normal"
|
||||
elif self.difficulty == 0:
|
||||
elif self.difficulty == Difficulty.EASY:
|
||||
self.string_diff = "_easy"
|
||||
self.is_clear = False
|
||||
self.is_rainbow = False
|
||||
@@ -2274,7 +2275,7 @@ class Gauge:
|
||||
self.gauge_length = 0
|
||||
|
||||
def update(self, current_ms: float):
|
||||
self.is_clear = self.gauge_length > self.clear_start[min(self.difficulty, 2)]-1
|
||||
self.is_clear = self.gauge_length > self.clear_start[min(self.difficulty, Difficulty.HARD)]-1
|
||||
self.is_rainbow = self.gauge_length == self.gauge_max
|
||||
if self.gauge_length == self.gauge_max and self.rainbow_fade_in is None:
|
||||
self.rainbow_fade_in = Animation.create_fade(450, initial_opacity=0.0, final_opacity=1.0)
|
||||
|
||||
@@ -9,7 +9,7 @@ from libs.animation import Animation
|
||||
from libs.audio import audio
|
||||
from libs.background import Background
|
||||
from libs.global_data import Modifiers, global_data
|
||||
from libs.tja import Balloon, Drumroll, Note, TJAParser, apply_modifiers
|
||||
from libs.tja import Balloon, Drumroll, Note, NoteType, TJAParser, apply_modifiers
|
||||
from libs.utils import get_current_ms, get_key_code
|
||||
from libs.texture import tex
|
||||
from scenes.game import DrumHitEffect, GameScreen, JudgeCounter, LaneHitEffect, Player, SCREEN_WIDTH
|
||||
@@ -163,7 +163,7 @@ class PracticeGameScreen(GameScreen):
|
||||
"""Draws a drumroll in the player's lane"""
|
||||
start_position = self.get_position_x(SCREEN_WIDTH, current_ms, head.load_ms, head.pixels_per_frame_x)
|
||||
tail = next((note for note in self.scrobble_note_list if note.index == index+1), self.scrobble_note_list[index+1])
|
||||
is_big = int(head.type == 6)
|
||||
is_big = int(head.type == NoteType.ROLL_HEAD_L)
|
||||
end_position = self.get_position_x(SCREEN_WIDTH, current_ms, tail.load_ms, tail.pixels_per_frame_x)
|
||||
length = end_position - start_position
|
||||
color = ray.Color(255, head.color, head.color, 255)
|
||||
@@ -216,7 +216,7 @@ class PracticeGameScreen(GameScreen):
|
||||
tex.draw_texture('notes', bar_type, frame=frame, x=x, y=y)
|
||||
|
||||
for note in reversed(self.scrobble_note_list):
|
||||
if note.type == 8:
|
||||
if note.type == NoteType.TAIL:
|
||||
continue
|
||||
|
||||
if isinstance(note, Drumroll):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
import pyray as ray
|
||||
|
||||
from libs.global_data import reset_session
|
||||
from libs.global_data import Difficulty, reset_session
|
||||
from libs.audio import audio
|
||||
from libs.chara_2d import Chara2D
|
||||
from libs.global_objects import AllNetIcon, CoinOverlay, Nameplate
|
||||
@@ -469,15 +469,15 @@ class Gauge:
|
||||
def __init__(self, player_num: str, gauge_length: float, is_2p: bool):
|
||||
self.is_2p = is_2p
|
||||
self.player_num = player_num
|
||||
self.difficulty = min(2, global_data.session_data[int(player_num)-1].selected_difficulty)
|
||||
self.difficulty = min(Difficulty.HARD, global_data.session_data[int(player_num)-1].selected_difficulty)
|
||||
self.gauge_length = gauge_length
|
||||
self.clear_start = [69, 69, 69]
|
||||
self.gauge_max = 87
|
||||
if self.difficulty >= 2:
|
||||
if self.difficulty >= Difficulty.HARD:
|
||||
self.string_diff = "_hard"
|
||||
elif self.difficulty == 1:
|
||||
elif self.difficulty == Difficulty.NORMAL:
|
||||
self.string_diff = "_normal"
|
||||
elif self.difficulty == 0:
|
||||
elif self.difficulty == Difficulty.EASY:
|
||||
self.string_diff = "_easy"
|
||||
self.rainbow_animation = tex.get_animation(16)
|
||||
self.gauge_fade_in = tex.get_animation(17)
|
||||
|
||||
@@ -9,7 +9,7 @@ from libs.file_navigator import DanCourse, navigator
|
||||
from libs.audio import audio
|
||||
from libs.chara_2d import Chara2D
|
||||
from libs.file_navigator import Directory, SongBox, SongFile
|
||||
from libs.global_data import Modifiers
|
||||
from libs.global_data import Difficulty, Modifiers
|
||||
from libs.global_objects import AllNetIcon, CoinOverlay, Nameplate, Indicator, Timer
|
||||
from libs.screen import Screen
|
||||
from libs.texture import tex
|
||||
@@ -559,7 +559,7 @@ class SongSelectPlayer:
|
||||
elif is_r_kat_pressed(self.player_num):
|
||||
ret_val = self._navigate_difficulty_right(diffs)
|
||||
|
||||
if 0 <= self.selected_difficulty <= 4 and self.selected_difficulty != prev_diff:
|
||||
if Difficulty.EASY <= self.selected_difficulty <= Difficulty.URA and self.selected_difficulty != prev_diff:
|
||||
self.selected_diff_bounce.start()
|
||||
self.selected_diff_fadein.start()
|
||||
|
||||
@@ -567,7 +567,7 @@ class SongSelectPlayer:
|
||||
return ret_val
|
||||
|
||||
if (ray.is_key_pressed(ray.KeyboardKey.KEY_TAB) and
|
||||
self.selected_difficulty in [3, 4]):
|
||||
self.selected_difficulty in [Difficulty.ONI, Difficulty.URA]):
|
||||
return self._toggle_ura_mode()
|
||||
|
||||
return None
|
||||
@@ -575,7 +575,7 @@ class SongSelectPlayer:
|
||||
def _navigate_difficulty_left(self, diffs):
|
||||
"""Navigate difficulty selection leftward"""
|
||||
self.diff_select_move_right = False
|
||||
if self.is_ura and self.selected_difficulty == 4:
|
||||
if self.is_ura and self.selected_difficulty == Difficulty.URA:
|
||||
self.diff_selector_move_1.start()
|
||||
self.prev_diff = self.selected_difficulty
|
||||
if len(diffs) == 1:
|
||||
@@ -604,12 +604,12 @@ class SongSelectPlayer:
|
||||
def _navigate_difficulty_right(self, diffs):
|
||||
"""Navigate difficulty selection rightward"""
|
||||
self.diff_select_move_right = True
|
||||
if self.is_ura and self.selected_difficulty == 2:
|
||||
if self.is_ura and self.selected_difficulty == Difficulty.HARD:
|
||||
self.prev_diff = self.selected_difficulty
|
||||
self.selected_difficulty = 4
|
||||
self.selected_difficulty = Difficulty.URA
|
||||
self.diff_selector_move_1.start()
|
||||
|
||||
if (self.selected_difficulty in [3, 4] and 4 in diffs and 3 in diffs):
|
||||
if (self.selected_difficulty in [Difficulty.ONI, Difficulty.URA] and Difficulty.URA in diffs and Difficulty.ONI in diffs):
|
||||
self.ura_toggle = (self.ura_toggle + 1) % 10
|
||||
if self.ura_toggle == 0:
|
||||
return self._toggle_ura_mode()
|
||||
@@ -646,7 +646,7 @@ class SongSelectPlayer:
|
||||
name = f'{self.player_num}p_outline_back_half' if is_half else f'{self.player_num}p_outline_back'
|
||||
tex.draw_texture('diff_select', name, x=((self.prev_diff+3) * 70) + (self.diff_selector_move_2.attribute * direction))
|
||||
else:
|
||||
difficulty = min(3, self.selected_difficulty)
|
||||
difficulty = min(Difficulty.ONI, self.selected_difficulty)
|
||||
name = f'{self.player_num}p_balloon_half' if is_half else f'{self.player_num}p_balloon'
|
||||
tex.draw_texture('diff_select', name, x=(difficulty * 115), fade=fade)
|
||||
name = f'{self.player_num}p_outline_half' if is_half else f'{self.player_num}p_outline'
|
||||
@@ -667,34 +667,34 @@ class SongSelectPlayer:
|
||||
if self.prev_diff == -1:
|
||||
return
|
||||
if not self.diff_selector_move_1.is_finished:
|
||||
difficulty = min(3, self.prev_diff)
|
||||
difficulty = min(Difficulty.ONI, self.prev_diff)
|
||||
name = f'{self.player_num}p_balloon_half' if is_half else f'{self.player_num}p_balloon'
|
||||
tex.draw_texture('diff_select', name, x=(difficulty * 115) + (self.diff_selector_move_1.attribute * direction), fade=fade)
|
||||
name = f'{self.player_num}p_outline_half' if is_half else f'{self.player_num}p_outline'
|
||||
tex.draw_texture('diff_select', name, x=(difficulty * 115) + (self.diff_selector_move_1.attribute * direction))
|
||||
else:
|
||||
difficulty = min(3, self.selected_difficulty)
|
||||
difficulty = min(Difficulty.ONI, self.selected_difficulty)
|
||||
name = f'{self.player_num}p_balloon_half' if is_half else f'{self.player_num}p_balloon'
|
||||
tex.draw_texture('diff_select', name, x=(difficulty * 115), fade=fade)
|
||||
name = f'{self.player_num}p_outline_half' if is_half else f'{self.player_num}p_outline'
|
||||
tex.draw_texture('diff_select', name, x=(difficulty * 115))
|
||||
|
||||
def draw_background_diffs(self, state: int):
|
||||
if (self.selected_song and state == State.SONG_SELECTED and self.selected_difficulty >= 0):
|
||||
if (self.selected_song and state == State.SONG_SELECTED and self.selected_difficulty >= Difficulty.EASY):
|
||||
if self.player_num == '2':
|
||||
tex.draw_texture('global', 'background_diff', frame=self.selected_difficulty, fade=min(0.5, self.selected_diff_fadein.attribute), x=1025, y=-self.selected_diff_bounce.attribute, y2=self.selected_diff_bounce.attribute)
|
||||
if self.selected_diff_highlight_fade.is_reversing or self.selected_diff_highlight_fade.is_finished:
|
||||
tex.draw_texture('global', 'background_diff', frame=self.selected_difficulty, x=1025, y=-self.selected_diff_bounce.attribute, y2=self.selected_diff_bounce.attribute)
|
||||
tex.draw_texture('global', 'background_diff_highlight', frame=min(3, self.selected_difficulty), fade=self.selected_diff_highlight_fade.attribute, x=1025)
|
||||
tex.draw_texture('global', 'background_diff_highlight', frame=min(Difficulty.ONI, self.selected_difficulty), fade=self.selected_diff_highlight_fade.attribute, x=1025)
|
||||
tex.draw_texture('global', 'bg_diff_text_bg', x=1025, fade=min(0.5, self.selected_diff_text_fadein.attribute), scale=self.selected_diff_text_resize.attribute, center=True)
|
||||
tex.draw_texture('global', 'bg_diff_text', frame=min(3, self.selected_difficulty), x=1025, fade=self.selected_diff_text_fadein.attribute, scale=self.selected_diff_text_resize.attribute, center=True)
|
||||
tex.draw_texture('global', 'bg_diff_text', frame=min(Difficulty.ONI, self.selected_difficulty), x=1025, fade=self.selected_diff_text_fadein.attribute, scale=self.selected_diff_text_resize.attribute, center=True)
|
||||
else:
|
||||
tex.draw_texture('global', 'background_diff', frame=self.selected_difficulty, fade=min(0.5, self.selected_diff_fadein.attribute), y=-self.selected_diff_bounce.attribute, y2=self.selected_diff_bounce.attribute)
|
||||
if self.selected_diff_highlight_fade.is_reversing or self.selected_diff_highlight_fade.is_finished:
|
||||
tex.draw_texture('global', 'background_diff', frame=self.selected_difficulty, y=-self.selected_diff_bounce.attribute, y2=self.selected_diff_bounce.attribute)
|
||||
tex.draw_texture('global', 'background_diff_highlight', frame=min(3, self.selected_difficulty), fade=self.selected_diff_highlight_fade.attribute)
|
||||
tex.draw_texture('global', 'background_diff_highlight', frame=min(Difficulty.ONI, self.selected_difficulty), fade=self.selected_diff_highlight_fade.attribute)
|
||||
tex.draw_texture('global', 'bg_diff_text_bg', fade=min(0.5, self.selected_diff_text_fadein.attribute), scale=self.selected_diff_text_resize.attribute, center=True)
|
||||
tex.draw_texture('global', 'bg_diff_text', frame=min(3, self.selected_difficulty), fade=self.selected_diff_text_fadein.attribute, scale=self.selected_diff_text_resize.attribute, center=True)
|
||||
tex.draw_texture('global', 'bg_diff_text', frame=min(Difficulty.ONI, self.selected_difficulty), fade=self.selected_diff_text_fadein.attribute, scale=self.selected_diff_text_resize.attribute, center=True)
|
||||
|
||||
def draw(self, state: int, is_half: bool = False):
|
||||
if (self.selected_song and state == State.SONG_SELECTED):
|
||||
@@ -792,13 +792,13 @@ class DiffSortSelect:
|
||||
|
||||
def get_random_sort(self):
|
||||
diff = random.randint(0, 4)
|
||||
if diff == 0:
|
||||
if diff == Difficulty.EASY:
|
||||
level = random.randint(1, 5)
|
||||
elif diff == 1:
|
||||
elif diff == Difficulty.NORMAL:
|
||||
level = random.randint(1, 7)
|
||||
elif diff == 2:
|
||||
elif diff == Difficulty.HARD:
|
||||
level = random.randint(1, 8)
|
||||
elif diff == 3:
|
||||
elif diff == Difficulty.ONI:
|
||||
level = random.randint(1, 10)
|
||||
else:
|
||||
level = random.choice([1, 5, 6, 7, 8, 9, 10])
|
||||
@@ -936,7 +936,7 @@ class DiffSortSelect:
|
||||
if i < 4:
|
||||
tex.draw_texture('diff_sort', 'box_diff', x=(100*i), frame=i)
|
||||
|
||||
if 0 <= self.selected_box <= 3 or self.selected_box == 5:
|
||||
if Difficulty.EASY <= self.selected_box <= Difficulty.ONI or self.selected_box == 5:
|
||||
self.draw_statistics()
|
||||
|
||||
def draw_level_select(self):
|
||||
|
||||
@@ -37,8 +37,8 @@ class TwoPlayerGameScreen(GameScreen):
|
||||
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[0]) / "don.ogg", 'hitsound_don_1p')
|
||||
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[0]) / "ka.ogg", 'hitsound_kat_1p')
|
||||
logger.info("Loaded ogg hit sounds for 1P")
|
||||
audio.set_sound_pan('hitsound_don_1p', 1.0)
|
||||
audio.set_sound_pan('hitsound_kat_1p', 1.0)
|
||||
audio.set_sound_pan('hitsound_don_1p', 0.0)
|
||||
audio.set_sound_pan('hitsound_kat_1p', 0.0)
|
||||
|
||||
# Load hitsounds for 2P
|
||||
if global_data.hit_sound[1] == -1:
|
||||
@@ -53,8 +53,8 @@ class TwoPlayerGameScreen(GameScreen):
|
||||
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[1]) / "don.ogg", 'hitsound_don_2p')
|
||||
audio.load_sound(sounds_dir / "hit_sounds" / str(global_data.hit_sound[1]) / "ka.ogg", 'hitsound_kat_2p')
|
||||
logger.info("Loaded ogg hit sounds for 2P")
|
||||
audio.set_sound_pan('hitsound_don_2p', 0.0)
|
||||
audio.set_sound_pan('hitsound_kat_2p', 0.0)
|
||||
audio.set_sound_pan('hitsound_don_2p', 1.0)
|
||||
audio.set_sound_pan('hitsound_kat_2p', 1.0)
|
||||
|
||||
def global_keys(self):
|
||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_F1):
|
||||
|
||||
Reference in New Issue
Block a user