Add titles and attributions

This commit is contained in:
2022-01-24 13:16:27 -06:00
parent c2e59d08aa
commit 369f90a68d
2 changed files with 36 additions and 15 deletions

View File

@@ -1,4 +1,3 @@
use storybook;
use gdnative::prelude::*;
fn init(handle: InitHandle){
@@ -84,23 +83,30 @@ impl Book {
storybook::Footer::Goto(_) => Footer::Goto,
storybook::Footer::Choices(choices) => {
Footer::Choices(choices.iter().map(|(o, c)| Choice {
option: o.clone(),
option: *o,
flavor: c.flavor.clone(),
stat_check: match &c.stat_check {
Some(c) => Some(StatCheck::new(c)),
None => None,
},
stat_change: match &c.stat_change {
Some(c) => Some(StatChange::new(c)),
None => None,
},
stat_check: c.stat_check.as_ref().map(StatCheck::new),
stat_change: c.stat_change.as_ref().map(StatChange::new),
}).collect())
},
},
None => Footer::None,
}
}
#[export]
fn get_title(&self, _owner: &Reference) -> String {
match &self._book {
Some(b) => b.title.clone(),
None => String::new(),
}
}
#[export]
fn get_attribution(&self, _owner: &Reference) -> String {
match &self._book {
Some(b) => b.attribution.clone(),
None => String::new(),
}
}
}
impl StatCheck {