first attempt at adding league or user info to the game display
This commit is contained in:
parent
5689a017c2
commit
debffec9b0
|
@ -30,9 +30,10 @@ def update_loop():
|
|||
states_to_send = {}
|
||||
game_times = iter(master_games_dic.copy().keys())
|
||||
for game_time in game_times:
|
||||
this_game, state = master_games_dic[game_time]
|
||||
this_game, state, discrim_string = master_games_dic[game_time]
|
||||
test_string = this_game.gamestate_display_full()
|
||||
|
||||
print(discrim_string)
|
||||
state["leagueoruser"] = discrim_string
|
||||
state["display_inning"] = this_game.inning #games need to be initialized with the following keys in state:
|
||||
state["outs"] = this_game.outs #away_name
|
||||
state["pitcher"] = this_game.get_pitcher().name #home_name
|
||||
|
@ -123,5 +124,6 @@ def update_loop():
|
|||
|
||||
global last_update
|
||||
last_update = states_to_send
|
||||
|
||||
socketio.emit("states_update", states_to_send)
|
||||
time.sleep(6)
|
||||
|
|
|
@ -46,4 +46,5 @@
|
|||
</div>
|
||||
<div class="footer">
|
||||
<div class="batting"></div>
|
||||
<div class="leagueoruser"></div>
|
||||
</div>
|
|
@ -190,6 +190,18 @@ h2 {
|
|||
padding: 5px;
|
||||
}
|
||||
|
||||
.leagueoruser {
|
||||
font-size: 10pt;
|
||||
text-align: right;
|
||||
height: max-content;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.outs {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
@ -250,6 +262,8 @@ h2 {
|
|||
margin-top: 10px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.update_emoji, .update_text {
|
||||
display: inline
|
||||
}
|
||||
|
|
|
@ -103,6 +103,8 @@ $(document).ready(function (){
|
|||
$('#updateTarget .update_text').html(gamestate.update_text);
|
||||
|
||||
$('#updateTarget .batting').html((gamestate.display_top_of_inning ? gamestate.away_name : gamestate.home_name) + " batting.");
|
||||
console.log(gamestate.leagueoruser)
|
||||
$('#updateTarget .leagueoruser').html(gamestate.leagueoruser);
|
||||
|
||||
gamediv.id = "";
|
||||
};
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<title>⚾ The Simmadome</title>
|
||||
<meta property="og:title" content="Watch at the Simmadome" />
|
||||
<meta property="og:description" content="The Simsim: Your players, your teams, your games." />
|
||||
<meta name="twitter:card" content="summary"></meta>
|
||||
<meta name="twitter:site" content="@SIBR_XVI"></meta>
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:site" content="@SIBR_XVI">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<Content Include="ids" />
|
||||
<Content Include="matteo.db" />
|
||||
<Content Include="static\discord.png" />
|
||||
<Content Include="static\game.html" />
|
||||
<Content Include="static\games_page.css" />
|
||||
<Content Include="static\loader.js" />
|
||||
<Content Include="static\prism.png" />
|
||||
|
|
|
@ -549,7 +549,7 @@ Creator, type `{newgame.name} done` to finalize lineups.""")
|
|||
game_task = asyncio.create_task(watch_game(channel, newgame))
|
||||
await game_task
|
||||
|
||||
async def watch_game(channel, newgame, user = None):
|
||||
async def watch_game(channel, newgame, user = None, league = None):
|
||||
blank_emoji = discord.utils.get(client.emojis, id = 790899850295509053)
|
||||
empty_base = discord.utils.get(client.emojis, id = 790899850395779074)
|
||||
occupied_base = discord.utils.get(client.emojis, id = 790899850320543745)
|
||||
|
@ -574,10 +574,17 @@ async def watch_game(channel, newgame, user = None):
|
|||
"end_delay" : 3
|
||||
}
|
||||
|
||||
if league is not None:
|
||||
discrim_string = league
|
||||
elif user is not None:
|
||||
discrim_string = f"Started by {user.name}"
|
||||
else:
|
||||
discrim_string = "Unclaimed game."
|
||||
|
||||
await channel.send(f"{newgame.teams['away'].name} vs. {newgame.teams['home'].name}, starting at {config()['simmadome_url']}")
|
||||
gamesarray.append((newgame, channel, user))
|
||||
|
||||
main_controller.master_games_dic[str(time.time() * 1000.0)] = (newgame, state_init)
|
||||
main_controller.master_games_dic[str(time.time() * 1000.0)] = (newgame, state_init, discrim_string)
|
||||
|
||||
async def play_from_queue(channel, game, user_mention):
|
||||
await channel.send(f"{user_mention}, your game's ready.")
|
||||
|
|
Loading…
Reference in New Issue
Block a user