4 Commits

Author SHA1 Message Date
Anthony Samms
c5a3f1e9e5 disable discord 2026-02-02 09:57:19 -05:00
Anthony Samms
46ddce2443 add funassyi 2026-01-23 10:39:35 -05:00
Anthony Samms
ae2702b3dd add funassyi 2026-01-23 10:38:48 -05:00
Anthony Samms
034be723c9 Update PyTaiko.py 2026-01-18 14:50:05 -05:00
6 changed files with 84 additions and 9 deletions

View File

@@ -47,6 +47,7 @@ from scenes.two_player.result import TwoPlayerResultScreen
from scenes.two_player.song_select import TwoPlayerSongSelectScreen
logger = logging.getLogger(__name__)
'''
DISCORD_APP_ID = '1451423960401973353'
try:
RPC = Presence(DISCORD_APP_ID)
@@ -55,6 +56,7 @@ try:
except Exception as e:
discord_connected = False
logger.warning(f"Could not connect to Discord: {e}")
'''
class Screens:
TITLE = "TITLE"
@@ -279,13 +281,14 @@ def check_discord_heartbeat(current_screen):
details = f"Playing Song: {global_data.session_data[global_data.player_num].song_title}"
else:
details = "Idling"
'''
RPC.update(
state=f"In Screen {current_screen}",
details=details,
large_text="PyTaiko",
start=get_current_ms()/1000,
buttons=[{"label": "Play Now", "url": "https://github.com/Yonokid/PyTaiko"}]
)
)'''
def draw_fps(last_fps: int):
curr_fps = ray.GetFPS()
@@ -400,9 +403,9 @@ def main():
while not ray.WindowShouldClose():
current_time = get_current_ms()
if discord_connected and current_time > last_discord_check + 1000:
check_discord_heartbeat(current_screen)
last_discord_check = current_time
#if discord_connected and current_time > last_discord_check + 1000:
#check_discord_heartbeat(current_screen)
#last_discord_check = current_time
if ray.IsKeyPressed(global_data.config["keys"]["fullscreen_key"]):
ray.ToggleFullscreen()
@@ -444,8 +447,10 @@ def main():
ray.CloseWindow()
audio.close_audio_device()
if discord_connected:
RPC.close()
#if discord_connected:
#RPC.close()
global_tex.unload_textures()
screen_mapping[current_screen].on_screen_end("LOADING")
logger.info("Window closed and audio device shut down")
if __name__ == "__main__":

View File

@@ -26,6 +26,7 @@ class Background:
"IMAS_CG": (libs.bg_collabs.imas.Background, 'background/collab/imas_cg', 3),
"IMAS_ML": (libs.bg_collabs.imas.Background, 'background/collab/imas_ml', 3),
"IMAS_SIDEM": (libs.bg_collabs.imas_sidem.Background, 'background/collab/imas_sidem', 3),
"FUNASSYI": (libs.bg_collabs.funassyi.Background, 'background/collab/funassyi', 5),
"DAN": (libs.bg_collabs.dan.Background, 'background/collab/dan', 1),
"PRACTICE": (libs.bg_collabs.practice.Background, 'background/collab/practice', 1)
}

View File

@@ -6,3 +6,4 @@ from . import imas
from . import dan
from . import imas_sidem
from . import practice
from . import funassyi

View File

@@ -0,0 +1,66 @@
from libs.bg_objects.bg_fever import BGFeverBase
from libs.bg_objects.bg_normal import BGNormalBase
from libs.bg_objects.chibi import ChibiController
from libs.bg_objects.dancer import BaseDancer, BaseDancerGroup
from libs.bg_objects.don_bg import DonBG4
from libs.bg_objects.renda import RendaController
from libs.bg_objects.fever import Fever0
from libs.bg_objects.footer import Footer
from libs.global_data import PlayerNum
from libs.texture import TextureWrapper
class Background:
def __init__(self, tex: TextureWrapper, player_num: PlayerNum, bpm: float, path: str, max_dancers: int):
self.tex_wrapper = tex
self.max_dancers = max_dancers
self.don_bg = DonBG4(tex, 0, player_num, path)
self.bg_normal = BGNormalBase(self.tex_wrapper, 0, path)
self.bg_fever = BGFever(self.tex_wrapper, 0, path)
self.footer = Footer(self.tex_wrapper, 2)
self.fever = Fever0(self.tex_wrapper, 0, bpm)
self.dancer = DancerGroup(self.tex_wrapper, 0, bpm, max_dancers, path)
self.renda = RendaController(self.tex_wrapper, 0)
self.chibi = ChibiController(self.tex_wrapper, 0, bpm, path)
class DancerGroup(BaseDancerGroup):
def __init__(self, tex: TextureWrapper, index: int, bpm: float, max_dancers: int, path: str):
self.name = 'dancer_' + str(index)
self.active_count = 0
tex.load_zip(path, f'dancer/{self.name}')
self.spawn_positions = [2, 1, 3, 0, 4]
self.active_dancers = [None] * max_dancers
self.dancers = [BaseDancer(self.name, 0, bpm, tex),
BaseDancer(self.name, 1, bpm, tex),
BaseDancer(self.name, 2, bpm, tex),
BaseDancer(self.name, 3, bpm, tex),
BaseDancer(self.name, 4, bpm, tex)]
self.add_dancer()
class BGFever(BGFeverBase):
def __init__(self, tex: TextureWrapper, index: int, path: str):
super().__init__(tex, index, path)
self.horizontal_move = tex.get_animation(16)
self.bg_texture_move_down = tex.get_animation(17)
self.bg_texture_move_up = tex.get_animation(18)
def start(self):
self.bg_texture_move_down.start()
self.bg_texture_move_up.start()
def update(self, current_time_ms: float):
self.bg_texture_move_down.update(current_time_ms)
self.bg_texture_move_up.update(current_time_ms)
if self.bg_texture_move_up.is_finished and not self.transitioned:
self.transitioned = True
self.horizontal_move.restart()
if self.transitioned:
self.horizontal_move.update(current_time_ms)
def draw(self, tex: TextureWrapper):
y = self.bg_texture_move_down.attribute - self.bg_texture_move_up.attribute
tex.draw_texture(self.name, 'background', y=y)
tex.draw_texture(self.name, 'overlay', x=-self.horizontal_move.attribute, y=y)
tex.draw_texture(self.name, 'overlay', x=tex.textures[self.name]['overlay'].width - self.horizontal_move.attribute, y=y)

View File

@@ -1,3 +1,4 @@
from libs.animation import Animation
from libs.global_data import PlayerNum
from libs.texture import TextureWrapper
@@ -14,7 +15,8 @@ class DonBGBase:
def __init__(self, tex: TextureWrapper, index: int, player_num: PlayerNum, path: str):
self.name = f'{index}_{player_num}'
tex.load_zip(path, f'donbg/{self.name}')
self.move = tex.get_animation(0)
self.move = Animation.create_move(3000, total_distance=-tex.textures[self.name]['background'].width, loop=True)
self.move.start()
self.is_clear = False
self.clear_fade = tex.get_animation(1)
@@ -97,7 +99,7 @@ class DonBG4(DonBGBase):
self.overlay_move.update(current_time_ms)
def _draw_textures(self, tex: TextureWrapper, fade: float, y: float):
for i in range(int(5 * tex.screen_scale)):
for i in range(5):
tex.draw_texture(self.name, 'background', frame=self.is_clear, fade=fade, x=(i*tex.textures[self.name]['background'].width)+self.move.attribute, y=y)
tex.draw_texture(self.name, 'overlay', frame=self.is_clear, fade=fade, x=(i*tex.textures[self.name]['overlay'].width)+self.move.attribute, y=self.overlay_move.attribute+y)