|
@@ -250,21 +250,7 @@ class Main: |
|
|
|
|
|
|
|
|
time.sleep (1.5) |
|
|
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: |
|
|
if not double_mode or random.random () < .5: |
|
|
break |
|
|
break |
|
@@ -306,16 +292,39 @@ class Main: |
|
|
kita, jojoko, |
|
|
kita, jojoko, |
|
|
sunrise_start, sunrise_end, sunset_start, sunset_end, |
|
|
sunrise_start, sunrise_end, sunset_start, sunset_end, |
|
|
sun_alt, sun_az, moon_alt, moon_az, moon_days_old) |
|
|
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, |
|
|
cls.draw_talking (screen, balloon, user_font, nizika_font, |
|
|
query, Talk.main (query).replace ('\n', ' ')) |
|
|
|
|
|
|
|
|
query, answer) |
|
|
noon.play () |
|
|
noon.play () |
|
|
time.sleep (1.5) |
|
|
time.sleep (1.5) |
|
|
|
|
|
cls.read_out (answer) |
|
|
|
|
|
|
|
|
for event in pygame.event.get (): |
|
|
for event in pygame.event.get (): |
|
|
if event.type == QUIT: |
|
|
if event.type == QUIT: |
|
|
pygame.quit () |
|
|
pygame.quit () |
|
|
sys.exit () |
|
|
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 |
|
|
@staticmethod |
|
|
def draw_talking ( |
|
|
def draw_talking ( |
|
|
screen: pygame.Surface, |
|
|
screen: pygame.Surface, |
|
@@ -376,7 +385,6 @@ class Main: |
|
|
|
|
|
|
|
|
pygame.display.update () |
|
|
pygame.display.update () |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
@classmethod |
|
|
def draw_bg ( |
|
|
def draw_bg ( |
|
|
cls, |
|
|
cls, |
|
|