Browse Source

#40

feature/040
みてるぞ 7 hours ago
parent
commit
7daee34ab1
1 changed files with 12 additions and 5 deletions
  1. +12
    -5
      main.py

+ 12
- 5
main.py View File

@@ -55,10 +55,11 @@ def main (
snack_time = SnackTime (game)
CurrentTime (game, DEERJIKA_FONT)

broadcast: Broadcast | None = None
try:
broadcast = Broadcast (os.environ['BROADCAST_CODE'])
except Exception:
pass
except KeyError:
broadcast = None

waiting_balloon = (False, '', '')
last_flags_poll: float = 0
@@ -99,10 +100,15 @@ def main (
answer_flag.answered = True
answer_flag.save ()
DB.commit ()
add_query (broadcast)
except Exception as ex:
DB.rollback ()
print (ex)

try:
if broadcast is not None:
add_query (broadcast)
except Exception as ex:
print (ex)
game.redraw ()


@@ -582,8 +588,9 @@ class Balloon (GameObject):
query = self.query
if CommonModule.len_by_full (query) > 21:
query = CommonModule.mid_by_full (query, 0, 19.5) + '...'
answer = Surface ((375, ((CommonModule.len_by_full (self.answer) - 1) // 16 + 1) * 23.4375),
pygame.SRCALPHA)
answer = Surface (
(375, int (((CommonModule.len_by_full (self.answer) - 1) // 16 + 1) * 23.4375)),
pygame.SRCALPHA)
for i in range (int (CommonModule.len_by_full (self.answer) - 1) // 16 + 1):
answer.blit (DEERJIKA_FONT.render (
CommonModule.mid_by_full (self.answer, 16 * i, 16), True, (192, 0, 0)),


Loading…
Cancel
Save