Browse Source

#30 ニジカが喋ってくれなかったので

main
みてるぞ 1 month ago
parent
commit
5583ded358
1 changed files with 25 additions and 17 deletions
  1. +25
    -17
      main.py

+ 25
- 17
main.py View File

@@ -250,21 +250,7 @@ class Main:

time.sleep (1.5)

# 返答の読上げを WAV ディタとして生成,取得
wav: bytearray | None
try:
wav = Aques.main (answer, goatoh_talking)
except:
wav = None

# 読上げを再生
if wav is not None:
with open ('./nizika_talking.wav', 'wb') as f:
f.write (wav)

playsound ('./nizika_talking.wav')

time.sleep (1)
cls.read_out (answer, goatoh_talking)

if not double_mode or random.random () < .5:
break
@@ -306,16 +292,39 @@ class Main:
kita, jojoko,
sunrise_start, sunrise_end, sunset_start, sunset_end,
sun_alt, sun_az, moon_alt, moon_az, moon_days_old)
answer = Talk.main (query).replace ('\n', ' ')
cls.draw_talking (screen, balloon, user_font, nizika_font,
query, Talk.main (query).replace ('\n', ' '))
query, answer)
noon.play ()
time.sleep (1.5)
cls.read_out (answer)

for event in pygame.event.get ():
if event.type == QUIT:
pygame.quit ()
sys.exit ()

@staticmethod
def read_out (
answer: str,
goatoh: bool = False,
) -> None:
# 返答の読上げを WAV ディタとして生成,取得
wav: bytearray | None
try:
wav = Aques.main (answer, goatoh)
except:
wav = None

# 読上げを再生
if wav is not None:
with open ('./nizika_talking.wav', 'wb') as f:
f.write (wav)

playsound ('./nizika_talking.wav')

time.sleep (1)

@staticmethod
def draw_talking (
screen: pygame.Surface,
@@ -376,7 +385,6 @@ class Main:

pygame.display.update ()


@classmethod
def draw_bg (
cls,


Loading…
Cancel
Save