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