背景時間帯によって変動
このコミットが含まれているのは:
バイナリ
バイナリファイルは表示されません.
|
変更後 幅: | 高さ: | サイズ: 57 KiB |
バイナリ
バイナリファイルは表示されません.
|
変更後 幅: | 高さ: | サイズ: 38 KiB |
@@ -1,3 +1,5 @@
|
||||
# vim: nosmartindent autoindent
|
||||
|
||||
import json
|
||||
import random
|
||||
import subprocess
|
||||
@@ -21,7 +23,11 @@ from youtube import *
|
||||
|
||||
class Main:
|
||||
@classmethod
|
||||
def main (cls, argv: list, argc: int) -> None:
|
||||
def main (
|
||||
cls,
|
||||
argv: list,
|
||||
argc: int) \
|
||||
-> None:
|
||||
mode = Mode.NIZIKA
|
||||
match (argc > 1) and argv[1]:
|
||||
case '-g':
|
||||
@@ -47,6 +53,16 @@ class Main:
|
||||
if goatoh_mode:
|
||||
balloon = pygame.transform.flip (balloon, False, True)
|
||||
|
||||
# 背景(夕方)
|
||||
bg_evening: pygame.Surface = pygame.transform.scale (
|
||||
pygame.image.load ('bg-evening.jpg'),
|
||||
(CWindow.WIDTH, CWindow.HEIGHT))
|
||||
|
||||
# 背景(夜)
|
||||
bg_night: pygame.Surface = pygame.transform.scale (
|
||||
pygame.image.load ('bg-night.jpg'),
|
||||
(CWindow.WIDTH, CWindow.HEIGHT))
|
||||
|
||||
# 音声再生器の初期化
|
||||
pygame.mixer.init (frequency = 44100)
|
||||
|
||||
@@ -78,7 +94,7 @@ class Main:
|
||||
histories: list = []
|
||||
|
||||
while (True):
|
||||
screen.fill ((0, 255, 0))
|
||||
cls.draw_bg (screen, bg_evening, bg_night)
|
||||
|
||||
# 左上に時刻表示
|
||||
for i in range (4):
|
||||
@@ -201,7 +217,7 @@ class Main:
|
||||
if not double_mode or random.random () < .5:
|
||||
break
|
||||
|
||||
screen.fill ((0, 255, 0))
|
||||
cls.draw_bg (screen, bg_evening, bg_night)
|
||||
|
||||
chat_item.author = {'name': 'ゴートうひとり' if goatoh_talking else '伊地知ニジカ',
|
||||
'id': '',
|
||||
@@ -224,8 +240,21 @@ class Main:
|
||||
pygame.quit ()
|
||||
sys.exit ()
|
||||
|
||||
@classmethod
|
||||
def draw_bg (
|
||||
cls,
|
||||
screen: pygame.Surface,
|
||||
bg_evening: pygame.Surface,
|
||||
bg_night: pygame.Surface) \
|
||||
-> None:
|
||||
if 17 <= (h := datetime.now ().hour) < 18:
|
||||
screen.blit (bg_evening, (0, 0))
|
||||
elif (h < 6) or (18 <= h):
|
||||
screen.blit (bg_night, (0, 0))
|
||||
else:
|
||||
screen.fill ((0, 255, 0))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Main.main ((len (sys.argv) > 1) and (sys.argv[1] == '-g'))
|
||||
Main.main (sys.argv, len (sys.argv))
|
||||
|
||||
|
||||
新しい課題から参照
ユーザをブロックする