diff --git a/character_window/Cargo.toml b/character_window/Cargo.toml index ebef6bd..406f8e2 100644 --- a/character_window/Cargo.toml +++ b/character_window/Cargo.toml @@ -11,3 +11,4 @@ downcast-rs = { workspace = true } engine = { workspace = true } rpg_components = { path = "../rpg_components" } +assetpath.workspace = true diff --git a/character_window/src/abilities/mod.rs b/character_window/src/abilities/mod.rs index 9e7f8f8..ebcd10e 100644 --- a/character_window/src/abilities/mod.rs +++ b/character_window/src/abilities/mod.rs @@ -225,7 +225,7 @@ impl AbilityPage { } impl Page for AbilityPage { - fn enable(&mut self) -> Result> { + fn enable(&mut self, world: &mut World) -> Result> { println!("enable AbilityPage"); for mode in self.modes.iter_mut() { @@ -237,11 +237,11 @@ impl Page for AbilityPage { Ok(self.grid.clone()) } - fn disable(&mut self) -> Result<()> { + fn disable(&mut self, world: &mut World) -> Result<()> { Ok(()) } - fn select(&self) -> Result<()> { + fn select(&self, world: &mut World) -> Result<()> { let mode = &self.modes[self.current_mode]; mode.content().select()?; @@ -255,19 +255,19 @@ impl Page for AbilityPage { Ok(()) } - fn next_tab(&mut self) -> Result<()> { + fn next_tab(&mut self, world: &mut World) -> Result<()> { self.modes[self.current_mode] .content_mut() .next_tab(&self.engine, self.hero) } - fn previous_tab(&mut self) -> Result<()> { + fn previous_tab(&mut self, world: &mut World) -> Result<()> { self.modes[self.current_mode] .content_mut() .previous_tab(&self.engine, self.hero) } - fn event(&mut self, button: ControllerButton) -> Result { + fn event(&mut self, world: &mut World, button: ControllerButton) -> Result { Ok(match button { ControllerButton::LeftStick => { self.current_mode = (self.current_mode + 1) % self.modes.len(); diff --git a/character_window/src/character/mod.rs b/character_window/src/character/mod.rs index 1eacade..0c80bb9 100644 --- a/character_window/src/character/mod.rs +++ b/character_window/src/character/mod.rs @@ -43,7 +43,7 @@ impl CharacterPage { strength.set_callback({ let update_stats = Self::create_update_stats(hero, engine, reference); - move || { + move |_world| { update_stats(|attributes| { attributes.add_strength(Strength::from(1)); }) @@ -54,7 +54,7 @@ impl CharacterPage { agility.set_callback({ let update_stats = Self::create_update_stats(hero, engine, reference); - move || { + move |_world| { update_stats(|attributes| { attributes.add_agility(Agility::from(1)); }) @@ -65,7 +65,7 @@ impl CharacterPage { intelligence.set_callback({ let update_stats = Self::create_update_stats(hero, engine, reference); - move || { + move |_world| { update_stats(|attributes| { attributes.add_intelligence(Intelligence::from(1)); }) @@ -80,14 +80,14 @@ impl CharacterPage { }) } - fn refresh(&self) -> Result<()> { - self.update_stats()?; - self.update_attributes()?; + fn refresh(&self, world: &mut World) -> Result<()> { + self.update_stats(world)?; + self.update_attributes(world)?; Ok(()) } - fn update_stats(&self, world: &World) -> Result<()> { + fn update_stats(&self, world: &mut World) -> Result<()> { let air_def: Arc