Added an end screen
This commit is contained in:
parent
fd3a923668
commit
5378ee9837
49
src/vn.rs
49
src/vn.rs
@ -76,6 +76,19 @@ fn render_dialog_block(block: &DialogBlock<Parameter>) -> Markup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_ending() -> Markup {
|
||||||
|
html! {
|
||||||
|
section .end-screen {
|
||||||
|
h1 { "End of scene" }
|
||||||
|
form method="POST" {
|
||||||
|
button type="submit" .restart-button {
|
||||||
|
"Play Again"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn generate_html(sections: Vec<Markup>) -> Markup {
|
fn generate_html(sections: Vec<Markup>) -> Markup {
|
||||||
let total_sections = sections.len();
|
let total_sections = sections.len();
|
||||||
|
|
||||||
@ -289,10 +302,34 @@ fn global_styles() -> Markup {
|
|||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
}";
|
}";
|
||||||
|
|
||||||
|
const END_STYLES: &str = r"
|
||||||
|
.end-screen {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
text-align: center;
|
||||||
|
background: rgba(0, 0, 0, 0.9);
|
||||||
|
color: white;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 1rem;
|
||||||
|
max-width: 600px;
|
||||||
|
}
|
||||||
|
.restart-button {
|
||||||
|
background: var(--character-bg);
|
||||||
|
color: white;
|
||||||
|
padding: 1rem 2rem;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}";
|
||||||
|
|
||||||
html! {
|
html! {
|
||||||
style {
|
style {
|
||||||
(maud::PreEscaped(
|
(maud::PreEscaped(
|
||||||
[BASE_STYLES, NAVIGATION, SCENE_STYLES, TEXTBOX_STYLES, CHARACTER_STYLES, CHOICE_STYLES]
|
[BASE_STYLES, NAVIGATION, SCENE_STYLES, TEXTBOX_STYLES, CHARACTER_STYLES, CHOICE_STYLES, END_STYLES]
|
||||||
.join("")
|
.join("")
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@ -466,17 +503,19 @@ pub fn render_novel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !choices.is_empty() {
|
let choices_html = if choices.is_empty() {
|
||||||
let choices_html = html! {
|
render_ending()
|
||||||
|
} else {
|
||||||
|
html! {
|
||||||
div .choices-section {
|
div .choices-section {
|
||||||
@for choice in choices {
|
@for choice in choices {
|
||||||
(render_choice(choice.1, choice.0, &progress))
|
(render_choice(choice.1, choice.0, &progress))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
sections.push(choices_html);
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sections.push(choices_html);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user