redo screen system
This commit is contained in:
35
untitled/screens/adoption.py
Normal file
35
untitled/screens/adoption.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from untitled import generation, model, rules, ui
|
||||
|
||||
|
||||
def adoption():
|
||||
print("Welcome to the shelter!")
|
||||
while True:
|
||||
auto_name = ""
|
||||
choice = "Reroll"
|
||||
while choice == "Reroll":
|
||||
choices = generation.generate_cat_choices()
|
||||
choice = ui.select(
|
||||
"Please choose a cat to adopt:",
|
||||
[ui.Choice(cat[0], cat[1]) for cat in choices] + ["Reroll"],
|
||||
)
|
||||
|
||||
while True:
|
||||
name = ui.text(
|
||||
'Please choose a name for your cat or type "idk" to autofill a generated one:',
|
||||
auto_name,
|
||||
)
|
||||
if name.lower() != "idk":
|
||||
auto_name = ""
|
||||
error = rules.validate_cat_name(name)
|
||||
if not error:
|
||||
break
|
||||
print(error)
|
||||
else:
|
||||
auto_name = generation.generate_name()
|
||||
|
||||
if ui.confirm(
|
||||
f"Do you want to adopt {name}, {generation.generate_trait_sentence(choice).lower()}?"
|
||||
):
|
||||
break
|
||||
|
||||
return model.Cat(name, choice)
|
||||
Reference in New Issue
Block a user