このコミットが含まれているのは:
+1
-1
サブモジュール nizika_ai が更新されました: 0dcc8656a1...9e136a7cb3
@@ -51,9 +51,8 @@ def main (
|
|||||||
y = CWindow.HEIGHT - 120,
|
y = CWindow.HEIGHT - 120,
|
||||||
balloon = balloon)
|
balloon = balloon)
|
||||||
CurrentTime (game, SYSTEM_FONT)
|
CurrentTime (game, SYSTEM_FONT)
|
||||||
broadcast = Broadcast (os.environ['BROADCAST_CODE'])
|
|
||||||
try:
|
try:
|
||||||
Sound ('assets/bgm.mp3').play (loops = -1)
|
broadcast = Broadcast (os.environ['BROADCAST_CODE'])
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
while True:
|
while True:
|
||||||
@@ -62,20 +61,23 @@ def main (
|
|||||||
pygame.quit ()
|
pygame.quit ()
|
||||||
sys.exit ()
|
sys.exit ()
|
||||||
if not balloon.enabled:
|
if not balloon.enabled:
|
||||||
DB.begin_transaction ()
|
try:
|
||||||
answer_flags = (AnsweredFlag.where ('platform', Platform.YOUTUBE.value)
|
DB.begin_transaction ()
|
||||||
.where ('answered', False)
|
answer_flags = (AnsweredFlag.where ('platform', Platform.YOUTUBE.value)
|
||||||
.get ())
|
.where ('answered', False)
|
||||||
if answer_flags:
|
.get ())
|
||||||
answer_flag = random.choice (answer_flags)
|
if answer_flags:
|
||||||
answer = Answer.find (answer_flag.answer_id)
|
answer_flag = random.choice (answer_flags)
|
||||||
if answer.answer_type == AnswerType.YOUTUBE_REPLY.value:
|
answer = Answer.find (answer_flag.answer_id)
|
||||||
query = Query.find (answer.query_id)
|
if answer.answer_type == AnswerType.YOUTUBE_REPLY.value:
|
||||||
deerjika.talk (query.content, answer.content)
|
query = Query.find (answer.query_id)
|
||||||
answer_flag.answered = True
|
deerjika.talk (query.content, answer.content)
|
||||||
answer_flag.save ()
|
answer_flag.answered = True
|
||||||
DB.commit ()
|
answer_flag.save ()
|
||||||
add_query (broadcast)
|
DB.commit ()
|
||||||
|
add_query (broadcast)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
game.redraw ()
|
game.redraw ()
|
||||||
|
|
||||||
|
|
||||||
@@ -149,6 +151,7 @@ class Game:
|
|||||||
sky (Sky): 天体情報
|
sky (Sky): 天体情報
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
bgm: Sound
|
||||||
clock: Clock
|
clock: Clock
|
||||||
frame: int
|
frame: int
|
||||||
last_answered_at: datetime
|
last_answered_at: datetime
|
||||||
@@ -165,6 +168,9 @@ class Game:
|
|||||||
self.clock = Clock ()
|
self.clock = Clock ()
|
||||||
self.frame = 0
|
self.frame = 0
|
||||||
self.redrawers = []
|
self.redrawers = []
|
||||||
|
self.bgm = Sound ('assets/bgm.mp3')
|
||||||
|
self.bgm.set_volume (.15)
|
||||||
|
self.bgm.play (loops = -1)
|
||||||
self._create_sky ()
|
self._create_sky ()
|
||||||
|
|
||||||
def redraw (
|
def redraw (
|
||||||
@@ -257,6 +263,10 @@ class BgBase (GameObject):
|
|||||||
surface (Surface): 背景 Surface
|
surface (Surface): 背景 Surface
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
bg: Surface
|
||||||
|
bg_evening: Surface
|
||||||
|
bg_grass: Surface
|
||||||
|
bg_night: Surface
|
||||||
surface: Surface
|
surface: Surface
|
||||||
|
|
||||||
def __init__ (
|
def __init__ (
|
||||||
@@ -264,8 +274,11 @@ class BgBase (GameObject):
|
|||||||
game: Game,
|
game: Game,
|
||||||
):
|
):
|
||||||
super ().__init__ (game)
|
super ().__init__ (game)
|
||||||
self.surface = pygame.image.load ('assets/bg.jpg')
|
self.bg = pygame.image.load ('assets/bg.jpg')
|
||||||
self.surface = pygame.transform.scale (self.surface, (CWindow.WIDTH, CWindow.HEIGHT))
|
self.bg_evening = pygame.image.load ('assets/bg-evening.jpg')
|
||||||
|
self.bg_grass = pygame.image.load ('assets/bg-grass.png')
|
||||||
|
self.bg_night = pygame.image.load ('assets/bg-night.jpg')
|
||||||
|
self.surface = pygame.transform.scale (self.bg, (CWindow.WIDTH, CWindow.HEIGHT))
|
||||||
|
|
||||||
def redraw (
|
def redraw (
|
||||||
self,
|
self,
|
||||||
@@ -370,7 +383,7 @@ class Deerjika (Creature):
|
|||||||
super ().redraw ()
|
super ().redraw ()
|
||||||
if (not self.balloon.enabled) and self.talking:
|
if (not self.balloon.enabled) and self.talking:
|
||||||
self.talking = False
|
self.talking = False
|
||||||
if (self.balloon.enabled and self.balloon.frame >= FPS * 3
|
if (self.balloon.enabled and self.balloon.frame >= FPS * 1.5
|
||||||
and not self.talking):
|
and not self.talking):
|
||||||
self.read_out ()
|
self.read_out ()
|
||||||
|
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする