Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- ui/renderers.py +59 -167
ui/renderers.py
CHANGED
|
@@ -11,18 +11,12 @@ from game.engine import (
|
|
| 11 |
from game.state import welcome_history
|
| 12 |
from models.mushroom import Mushroom
|
| 13 |
from ui.renderers import (
|
| 14 |
-
dex_markdown,
|
| 15 |
-
game_status_markdown,
|
| 16 |
-
|
| 17 |
-
home_forest_markdown,
|
| 18 |
-
mushroom_card,
|
| 19 |
-
play_hook_markdown,
|
| 20 |
-
progress_markdown,
|
| 21 |
world_map_markdown,
|
| 22 |
)
|
| 23 |
|
| 24 |
-
# Now your application will load successfully
|
| 25 |
-
|
| 26 |
EMPTY_COLLECTION = None
|
| 27 |
START_POSITION = (1, 1)
|
| 28 |
|
|
@@ -39,19 +33,20 @@ Follow clues until the Impossible Mushroom blooms inside the MycoDex.
|
|
| 39 |
GUIDE_MARKDOWN = """
|
| 40 |
## How to play
|
| 41 |
|
| 42 |
-
1.
|
| 43 |
-
2.
|
| 44 |
-
3. Choose your
|
| 45 |
-
- **๐ Study
|
| 46 |
-
- **๐ Pick
|
| 47 |
-
- **๐ Collect
|
| 48 |
- **๐ Follow Whisper** โ reveal mystery fragments. Risky on unstudied mushrooms!
|
| 49 |
- **๐ฝ๏ธ Eat?** โ Myco will stop you every time (for good reason).
|
| 50 |
4. **Ask Myco** anything in the chat โ it knows the forest, the mystery, and the mushrooms.
|
| 51 |
-
|
| 52 |
-
**Controls:** W/A/S/D or Arrows = Move ยท Q = Study ยท E = Pick ยท C = Collect
|
| 53 |
|
| 54 |
**Scoring:** Common = 10 spores ยท Rare = 35 ยท Legendary = 100 ยท Poison = โ25 + Game Over
|
|
|
|
|
|
|
| 55 |
"""
|
| 56 |
|
| 57 |
|
|
@@ -66,69 +61,6 @@ def mushroom_card_from_state(current):
|
|
| 66 |
)
|
| 67 |
|
| 68 |
|
| 69 |
-
def forest_scene(current, collection, position):
|
| 70 |
-
"""Renders an interactive, visually responsive CSS map representing the real game layout."""
|
| 71 |
-
px, py = _safe_pos(position)
|
| 72 |
-
|
| 73 |
-
html = """
|
| 74 |
-
<div style="
|
| 75 |
-
display: flex;
|
| 76 |
-
flex-direction: column;
|
| 77 |
-
align-items: center;
|
| 78 |
-
justify-content: center;
|
| 79 |
-
background: #111122;
|
| 80 |
-
padding: 20px;
|
| 81 |
-
border-radius: 12px;
|
| 82 |
-
border: 2px solid #2e2e4f;
|
| 83 |
-
margin-bottom: 15px;
|
| 84 |
-
">
|
| 85 |
-
<div style="color: #8a8aaf; font-weight: bold; margin-bottom: 12px; font-size: 13px; letter-spacing: 2px; font-family: monospace;">
|
| 86 |
-
๐ฒ MYCO FOREST VIEWPORT (3 ร 3) ๐ฒ
|
| 87 |
-
</div>
|
| 88 |
-
<div style="
|
| 89 |
-
display: grid;
|
| 90 |
-
grid-template-columns: repeat(3, 85px);
|
| 91 |
-
grid-template-rows: repeat(3, 85px);
|
| 92 |
-
gap: 10px;
|
| 93 |
-
">
|
| 94 |
-
"""
|
| 95 |
-
|
| 96 |
-
for y in range(3):
|
| 97 |
-
for x in range(3):
|
| 98 |
-
is_player = (x == px and y == py)
|
| 99 |
-
|
| 100 |
-
tile_style = """
|
| 101 |
-
width: 85px;
|
| 102 |
-
height: 85px;
|
| 103 |
-
background: #1b263b;
|
| 104 |
-
border-radius: 8px;
|
| 105 |
-
display: flex;
|
| 106 |
-
align-items: center;
|
| 107 |
-
justify-content: center;
|
| 108 |
-
font-size: 32px;
|
| 109 |
-
position: relative;
|
| 110 |
-
box-shadow: inset 0 0 12px rgba(0,0,0,0.6);
|
| 111 |
-
"""
|
| 112 |
-
|
| 113 |
-
if is_player:
|
| 114 |
-
tile_style += "border: 3px solid #00b4d8; background: #22333b; box-shadow: 0 0 18px rgba(0,180,216,0.4);"
|
| 115 |
-
cell_content = "๐งโโ๏ธ"
|
| 116 |
-
else:
|
| 117 |
-
cell_content = "๐ฒ"
|
| 118 |
-
|
| 119 |
-
coord_label = f'<span style="position: absolute; bottom: 4px; right: 6px; font-size: 9px; color: #415a77; font-family: monospace;">{x},{y}</span>'
|
| 120 |
-
html += f'<div style="{tile_style}">{cell_content}{coord_label}</div>'
|
| 121 |
-
|
| 122 |
-
html += f"""
|
| 123 |
-
</div>
|
| 124 |
-
<div style="margin-top: 14px; color: #00b4d8; font-size: 12px; font-family: monospace; letter-spacing: 1px;">
|
| 125 |
-
Coordinates: [X: {px}, Y: {py}]
|
| 126 |
-
</div>
|
| 127 |
-
</div>
|
| 128 |
-
"""
|
| 129 |
-
return html
|
| 130 |
-
|
| 131 |
-
|
| 132 |
def search_forest(collection, position):
|
| 133 |
mushroom, current, history = discover_mushroom(collection)
|
| 134 |
pos = _safe_pos(position)
|
|
@@ -201,27 +133,14 @@ def study_discovery(current, history, collection, position):
|
|
| 201 |
)
|
| 202 |
|
| 203 |
|
| 204 |
-
def move_player(position, direction, collection):
|
| 205 |
-
"""Calculates movement coordinates and instantly triggers a continuous gameplay search event loop."""
|
| 206 |
x, y = _safe_pos(position)
|
| 207 |
if direction == "north": y -= 1
|
| 208 |
elif direction == "south": y += 1
|
| 209 |
elif direction == "west": x -= 1
|
| 210 |
elif direction == "east": x += 1
|
| 211 |
pos = _safe_pos((x, y))
|
| 212 |
-
|
| 213 |
-
# Real Game Loop Mechanics: Moving handles exploration encounters automatically
|
| 214 |
-
mushroom, current, history = discover_mushroom(collection)
|
| 215 |
-
return (
|
| 216 |
-
pos,
|
| 217 |
-
forest_scene(current, collection, pos),
|
| 218 |
-
game_status_markdown(current, collection, pos),
|
| 219 |
-
mushroom_card_from_state(current),
|
| 220 |
-
current,
|
| 221 |
-
history,
|
| 222 |
-
dex_markdown(collection),
|
| 223 |
-
progress_markdown(collection),
|
| 224 |
-
)
|
| 225 |
|
| 226 |
|
| 227 |
def block_unsafe_eating(current, history):
|
|
@@ -248,45 +167,19 @@ def build_app():
|
|
| 248 |
transition: none !important;
|
| 249 |
animation: none !important;
|
| 250 |
}
|
| 251 |
-
/*
|
| 252 |
* {
|
| 253 |
-
transition:
|
| 254 |
}
|
| 255 |
.pending, .generating {
|
| 256 |
-
opacity:
|
| 257 |
background: transparent !important;
|
| 258 |
-
animation: none !important;
|
| 259 |
-
border: none !important;
|
| 260 |
-
box-shadow: none !important;
|
| 261 |
}
|
| 262 |
-
/*
|
| 263 |
.progress-level, .progress-level-inner {
|
| 264 |
display: none !important;
|
| 265 |
}
|
| 266 |
</style>
|
| 267 |
-
|
| 268 |
-
<script>
|
| 269 |
-
document.addEventListener('keydown', function(event) {
|
| 270 |
-
// Keep keyboard hotkeys completely quiet if typing a query in the chatbox input
|
| 271 |
-
if (event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA') return;
|
| 272 |
-
|
| 273 |
-
const keyMap = {
|
| 274 |
-
'w': 'btn-north', 'W': 'btn-north', 'ArrowUp': 'btn-north',
|
| 275 |
-
'a': 'btn-west', 'A': 'btn-west', 'ArrowLeft': 'btn-west',
|
| 276 |
-
's': 'btn-south', 'S': 'btn-south', 'ArrowDown': 'btn-south',
|
| 277 |
-
'd': 'btn-east', 'D': 'btn-east', 'ArrowRight': 'btn-east',
|
| 278 |
-
'e': 'btn-pick', 'E': 'btn-pick',
|
| 279 |
-
'q': 'btn-study', 'Q': 'btn-study',
|
| 280 |
-
'c': 'btn-collect', 'C': 'btn-collect'
|
| 281 |
-
};
|
| 282 |
-
|
| 283 |
-
const targetId = keyMap[event.key];
|
| 284 |
-
if (targetId) {
|
| 285 |
-
const btn = document.getElementById(targetId);
|
| 286 |
-
if (btn) btn.click();
|
| 287 |
-
}
|
| 288 |
-
});
|
| 289 |
-
</script>
|
| 290 |
""")
|
| 291 |
|
| 292 |
# โโ State โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
@@ -294,7 +187,8 @@ def build_app():
|
|
| 294 |
collection = gr.State([])
|
| 295 |
player_position = gr.State(START_POSITION)
|
| 296 |
|
| 297 |
-
# โโ Hero
|
|
|
|
| 298 |
|
| 299 |
with gr.Tabs(selected="home") as tabs:
|
| 300 |
|
|
@@ -309,17 +203,48 @@ def build_app():
|
|
| 309 |
|
| 310 |
# โโ PLAY โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 311 |
with gr.Tab("๐ฎ Play", id="play"):
|
| 312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
with gr.Row(equal_height=True):
|
| 314 |
with gr.Column(scale=2):
|
| 315 |
gr.Markdown("### ๐ Current Discovery")
|
| 316 |
discovery = gr.Markdown(mushroom_card(None))
|
| 317 |
with gr.Row():
|
| 318 |
-
study_button = gr.Button("๐ Study", variant="secondary"
|
| 319 |
-
collect_button = gr.Button("๐ Collect", variant="secondary"
|
| 320 |
with gr.Row():
|
| 321 |
-
whisper_button = gr.Button("๐ Follow Whisper", variant="secondary"
|
| 322 |
-
eat_button = gr.Button("๐ฝ๏ธ Eat?", variant="stop"
|
| 323 |
|
| 324 |
with gr.Column(scale=3):
|
| 325 |
gr.Markdown("### ๐ฌ Myco Chat")
|
|
@@ -338,34 +263,6 @@ def build_app():
|
|
| 338 |
)
|
| 339 |
ask_button = gr.Button("Ask ๐", variant="primary", scale=1)
|
| 340 |
|
| 341 |
-
# MIDDLE: Quest log
|
| 342 |
-
status = gr.Markdown(
|
| 343 |
-
game_status_markdown(None, EMPTY_COLLECTION, START_POSITION)
|
| 344 |
-
)
|
| 345 |
-
|
| 346 |
-
# BOTTOM: Forest Map + Controls
|
| 347 |
-
with gr.Row():
|
| 348 |
-
with gr.Column(scale=2):
|
| 349 |
-
scene = gr.HTML(
|
| 350 |
-
forest_scene(None, EMPTY_COLLECTION, START_POSITION),
|
| 351 |
-
elem_id="forest-scene",
|
| 352 |
-
)
|
| 353 |
-
with gr.Column(scale=1):
|
| 354 |
-
search_button = gr.Button("๐ฟ Inspect Current Spot", variant="secondary")
|
| 355 |
-
gr.Markdown("**Move Navigator (WASD / Arrows)**")
|
| 356 |
-
with gr.Row():
|
| 357 |
-
gr.HTML("<div></div>")
|
| 358 |
-
north_button = gr.Button("โฌ๏ธ", size="sm", elem_id="btn-north")
|
| 359 |
-
gr.HTML("<div></div>")
|
| 360 |
-
with gr.Row():
|
| 361 |
-
west_button = gr.Button("โฌ
๏ธ", size="sm", elem_id="btn-west")
|
| 362 |
-
pick_button = gr.Button("๐ Pick", variant="primary", size="sm", elem_id="btn-pick")
|
| 363 |
-
east_button = gr.Button("โก๏ธ", size="sm", elem_id="btn-east")
|
| 364 |
-
with gr.Row():
|
| 365 |
-
gr.HTML("<div></div>")
|
| 366 |
-
south_button = gr.Button("โฌ๏ธ", size="sm", elem_id="btn-south")
|
| 367 |
-
gr.HTML("<div></div>")
|
| 368 |
-
|
| 369 |
# โโ MYCODEX โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 370 |
with gr.Tab("๐ MycoDex"):
|
| 371 |
with gr.Row():
|
|
@@ -381,7 +278,7 @@ def build_app():
|
|
| 381 |
gr.Markdown(GUIDE_MARKDOWN)
|
| 382 |
|
| 383 |
# โโ Event wiring โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 384 |
-
start_play_button.click(open_play_tab, outputs=[tabs]
|
| 385 |
|
| 386 |
search_button.click(
|
| 387 |
search_forest,
|
|
@@ -409,8 +306,8 @@ def build_app():
|
|
| 409 |
]:
|
| 410 |
button.click(
|
| 411 |
move_player,
|
| 412 |
-
inputs=[player_position, gr.State(direction), collection],
|
| 413 |
-
outputs=[player_position, scene, status
|
| 414 |
show_progress="hidden",
|
| 415 |
)
|
| 416 |
|
|
@@ -418,13 +315,11 @@ def build_app():
|
|
| 418 |
study_discovery,
|
| 419 |
inputs=[current_mushroom, chat, collection, player_position],
|
| 420 |
outputs=[current_mushroom, scene, status, discovery, chat],
|
| 421 |
-
show_progress="hidden",
|
| 422 |
)
|
| 423 |
collect_button.click(
|
| 424 |
collect_discovery,
|
| 425 |
inputs=[current_mushroom, collection, chat, player_position],
|
| 426 |
outputs=[collection, scene, status, dex, world_map, chat, progress],
|
| 427 |
-
show_progress="hidden",
|
| 428 |
)
|
| 429 |
pick_button.click(
|
| 430 |
pick_discovery,
|
|
@@ -436,15 +331,12 @@ def build_app():
|
|
| 436 |
follow_story_whisper,
|
| 437 |
inputs=[current_mushroom, collection, chat, player_position],
|
| 438 |
outputs=[current_mushroom, scene, status, discovery, chat],
|
| 439 |
-
show_progress="hidden",
|
| 440 |
)
|
| 441 |
eat_button.click(
|
| 442 |
block_unsafe_eating,
|
| 443 |
inputs=[current_mushroom, chat],
|
| 444 |
outputs=[chat],
|
| 445 |
-
show_progress="hidden",
|
| 446 |
)
|
| 447 |
|
| 448 |
demo.queue()
|
| 449 |
return demo
|
| 450 |
-
|
|
|
|
| 11 |
from game.state import welcome_history
|
| 12 |
from models.mushroom import Mushroom
|
| 13 |
from ui.renderers import (
|
| 14 |
+
dex_markdown, forest_scene, game_intro_markdown,
|
| 15 |
+
game_status_markdown, hero_markdown, home_forest_markdown,
|
| 16 |
+
mushroom_card, play_hook_markdown, progress_markdown,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
world_map_markdown,
|
| 18 |
)
|
| 19 |
|
|
|
|
|
|
|
| 20 |
EMPTY_COLLECTION = None
|
| 21 |
START_POSITION = (1, 1)
|
| 22 |
|
|
|
|
| 33 |
GUIDE_MARKDOWN = """
|
| 34 |
## How to play
|
| 35 |
|
| 36 |
+
1. Go to **๐ฎ Play** and click **๐ฎ Search Clearing** to discover a mushroom.
|
| 37 |
+
2. **Myco (the AI) reacts** โ read what it senses about the mushroom.
|
| 38 |
+
3. Choose your action:
|
| 39 |
+
- **๐ Study** โ Myco examines the mushroom and updates its magic field.
|
| 40 |
+
- **๐ Pick** โ grab it as a game item. Poisonous picks = Game Over!
|
| 41 |
+
- **๐ Collect** โ add it to the MycoDex for safe keeping and score.
|
| 42 |
- **๐ Follow Whisper** โ reveal mystery fragments. Risky on unstudied mushrooms!
|
| 43 |
- **๐ฝ๏ธ Eat?** โ Myco will stop you every time (for good reason).
|
| 44 |
4. **Ask Myco** anything in the chat โ it knows the forest, the mystery, and the mushrooms.
|
| 45 |
+
5. Use **โฌ๏ธโฌ๏ธโฌ
๏ธโก๏ธ** to move through the 3ร3 forest grid.
|
|
|
|
| 46 |
|
| 47 |
**Scoring:** Common = 10 spores ยท Rare = 35 ยท Legendary = 100 ยท Poison = โ25 + Game Over
|
| 48 |
+
|
| 49 |
+
**Poisonous mushrooms:** Ghost Gill ยท Pepper Pixie ยท Ruby Knuckle ยท Clockwork Chanterelle
|
| 50 |
"""
|
| 51 |
|
| 52 |
|
|
|
|
| 61 |
)
|
| 62 |
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
def search_forest(collection, position):
|
| 65 |
mushroom, current, history = discover_mushroom(collection)
|
| 66 |
pos = _safe_pos(position)
|
|
|
|
| 133 |
)
|
| 134 |
|
| 135 |
|
| 136 |
+
def move_player(position, direction, current, collection):
|
|
|
|
| 137 |
x, y = _safe_pos(position)
|
| 138 |
if direction == "north": y -= 1
|
| 139 |
elif direction == "south": y += 1
|
| 140 |
elif direction == "west": x -= 1
|
| 141 |
elif direction == "east": x += 1
|
| 142 |
pos = _safe_pos((x, y))
|
| 143 |
+
return pos, forest_scene(current, collection, pos), game_status_markdown(current, collection, pos)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
|
| 145 |
|
| 146 |
def block_unsafe_eating(current, history):
|
|
|
|
| 167 |
transition: none !important;
|
| 168 |
animation: none !important;
|
| 169 |
}
|
| 170 |
+
/* Prevent white flash on component updates */
|
| 171 |
* {
|
| 172 |
+
transition: opacity 0.15s ease !important;
|
| 173 |
}
|
| 174 |
.pending, .generating {
|
| 175 |
+
opacity: 0.85 !important;
|
| 176 |
background: transparent !important;
|
|
|
|
|
|
|
|
|
|
| 177 |
}
|
| 178 |
+
/* Hide the white overlay Gradio adds during updates */
|
| 179 |
.progress-level, .progress-level-inner {
|
| 180 |
display: none !important;
|
| 181 |
}
|
| 182 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
""")
|
| 184 |
|
| 185 |
# โโ State โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
|
|
| 187 |
collection = gr.State([])
|
| 188 |
player_position = gr.State(START_POSITION)
|
| 189 |
|
| 190 |
+
# โโ Hero โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 191 |
+
gr.HTML(hero_markdown())
|
| 192 |
|
| 193 |
with gr.Tabs(selected="home") as tabs:
|
| 194 |
|
|
|
|
| 203 |
|
| 204 |
# โโ PLAY โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 205 |
with gr.Tab("๐ฎ Play", id="play"):
|
| 206 |
+
gr.HTML(game_intro_markdown())
|
| 207 |
+
|
| 208 |
+
# Forest scene + controls
|
| 209 |
+
scene = gr.HTML(
|
| 210 |
+
forest_scene(None, EMPTY_COLLECTION, START_POSITION),
|
| 211 |
+
elem_id="forest-scene",
|
| 212 |
+
)
|
| 213 |
+
|
| 214 |
+
with gr.Row():
|
| 215 |
+
with gr.Column(scale=1):
|
| 216 |
+
search_button = gr.Button("๐ฎ Search Clearing", variant="primary", size="lg")
|
| 217 |
+
with gr.Column(scale=1):
|
| 218 |
+
gr.Markdown("**Move Myco**")
|
| 219 |
+
with gr.Row():
|
| 220 |
+
gr.HTML("<div></div>")
|
| 221 |
+
north_button = gr.Button("โฌ๏ธ", size="sm")
|
| 222 |
+
gr.HTML("<div></div>")
|
| 223 |
+
with gr.Row():
|
| 224 |
+
west_button = gr.Button("โฌ
๏ธ", size="sm")
|
| 225 |
+
pick_button = gr.Button("๐ Pick", variant="primary", size="sm")
|
| 226 |
+
east_button = gr.Button("โก๏ธ", size="sm")
|
| 227 |
+
with gr.Row():
|
| 228 |
+
gr.HTML("<div></div>")
|
| 229 |
+
south_button = gr.Button("โฌ๏ธ", size="sm")
|
| 230 |
+
gr.HTML("<div></div>")
|
| 231 |
+
|
| 232 |
+
# Quest log
|
| 233 |
+
status = gr.Markdown(
|
| 234 |
+
game_status_markdown(None, EMPTY_COLLECTION, START_POSITION)
|
| 235 |
+
)
|
| 236 |
+
|
| 237 |
+
# Discovery card + action buttons + chat
|
| 238 |
with gr.Row(equal_height=True):
|
| 239 |
with gr.Column(scale=2):
|
| 240 |
gr.Markdown("### ๐ Current Discovery")
|
| 241 |
discovery = gr.Markdown(mushroom_card(None))
|
| 242 |
with gr.Row():
|
| 243 |
+
study_button = gr.Button("๐ Study", variant="secondary")
|
| 244 |
+
collect_button = gr.Button("๐ Collect", variant="secondary")
|
| 245 |
with gr.Row():
|
| 246 |
+
whisper_button = gr.Button("๐ Follow Whisper", variant="secondary")
|
| 247 |
+
eat_button = gr.Button("๐ฝ๏ธ Eat?", variant="stop")
|
| 248 |
|
| 249 |
with gr.Column(scale=3):
|
| 250 |
gr.Markdown("### ๐ฌ Myco Chat")
|
|
|
|
| 263 |
)
|
| 264 |
ask_button = gr.Button("Ask ๐", variant="primary", scale=1)
|
| 265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
# โโ MYCODEX โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 267 |
with gr.Tab("๐ MycoDex"):
|
| 268 |
with gr.Row():
|
|
|
|
| 278 |
gr.Markdown(GUIDE_MARKDOWN)
|
| 279 |
|
| 280 |
# โโ Event wiring โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 281 |
+
start_play_button.click(open_play_tab, outputs=[tabs])
|
| 282 |
|
| 283 |
search_button.click(
|
| 284 |
search_forest,
|
|
|
|
| 306 |
]:
|
| 307 |
button.click(
|
| 308 |
move_player,
|
| 309 |
+
inputs=[player_position, gr.State(direction), current_mushroom, collection],
|
| 310 |
+
outputs=[player_position, scene, status],
|
| 311 |
show_progress="hidden",
|
| 312 |
)
|
| 313 |
|
|
|
|
| 315 |
study_discovery,
|
| 316 |
inputs=[current_mushroom, chat, collection, player_position],
|
| 317 |
outputs=[current_mushroom, scene, status, discovery, chat],
|
|
|
|
| 318 |
)
|
| 319 |
collect_button.click(
|
| 320 |
collect_discovery,
|
| 321 |
inputs=[current_mushroom, collection, chat, player_position],
|
| 322 |
outputs=[collection, scene, status, dex, world_map, chat, progress],
|
|
|
|
| 323 |
)
|
| 324 |
pick_button.click(
|
| 325 |
pick_discovery,
|
|
|
|
| 331 |
follow_story_whisper,
|
| 332 |
inputs=[current_mushroom, collection, chat, player_position],
|
| 333 |
outputs=[current_mushroom, scene, status, discovery, chat],
|
|
|
|
| 334 |
)
|
| 335 |
eat_button.click(
|
| 336 |
block_unsafe_eating,
|
| 337 |
inputs=[current_mushroom, chat],
|
| 338 |
outputs=[chat],
|
|
|
|
| 339 |
)
|
| 340 |
|
| 341 |
demo.queue()
|
| 342 |
return demo
|
|
|