Try to solve tool tip disabling
This commit is contained in:
parent
adda066782
commit
e2eb7e8722
6 changed files with 19 additions and 15 deletions
|
@ -106,7 +106,7 @@ impl<A: Ability + 'static> AbilityPageRightSide<A> {
|
||||||
menu.add_tooltip("active_ability", gui);
|
menu.add_tooltip("active_ability", gui);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
menu.remove_tooltip("active_ability");
|
menu.remove_tooltip(world, "active_ability")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ impl<A: Ability + 'static> ContentUpdate for Content<A, AbilityAddon> {
|
||||||
} else {
|
} else {
|
||||||
let window = reference.upgrade().unwrap();
|
let window = reference.upgrade().unwrap();
|
||||||
|
|
||||||
window.remove_tooltip(format!("addon_{index}"));
|
window.remove_tooltip(world, format!("addon_{index}"))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -275,8 +275,8 @@ impl<A: Ability + 'static> ContentUpdate for Content<A, AbilityBook<A>> {
|
||||||
} else {
|
} else {
|
||||||
let window = reference.upgrade().unwrap();
|
let window = reference.upgrade().unwrap();
|
||||||
|
|
||||||
window.remove_tooltip(format!("book_{index}"));
|
window.remove_tooltip(world, format!("book_{index}"))?;
|
||||||
window.remove_tooltip("active_book");
|
window.remove_tooltip(world, "active_book")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -217,8 +217,8 @@ impl<A: Ability + 'static> ContentUpdate for Content<A, Item> {
|
||||||
} else {
|
} else {
|
||||||
let window = reference.upgrade().unwrap();
|
let window = reference.upgrade().unwrap();
|
||||||
|
|
||||||
window.remove_tooltip(format!("item_{index}"));
|
window.remove_tooltip(world, format!("item_{index}"))?;
|
||||||
window.remove_tooltip("equip");
|
window.remove_tooltip(world, "equip")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -337,7 +337,7 @@ impl<A: Ability + 'static> ContentUpdate for Content<A, Jewel> {
|
||||||
} else {
|
} else {
|
||||||
let window = reference.upgrade().unwrap();
|
let window = reference.upgrade().unwrap();
|
||||||
|
|
||||||
window.remove_tooltip(format!("jewel_{index}"));
|
window.remove_tooltip(world, format!("jewel_{index}"))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -211,11 +211,11 @@ mod macros {
|
||||||
reference.upgrade().unwrap().add_tooltip("equip", gui);
|
reference.upgrade().unwrap().add_tooltip("equip", gui);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
reference.upgrade().unwrap().remove_tooltip("equip");
|
reference.upgrade().unwrap().remove_tooltip(world, "equip")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reference.upgrade().unwrap().remove_tooltip("equip");
|
reference.upgrade().unwrap().remove_tooltip(world, "equip")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -346,11 +346,11 @@ mod macros {
|
||||||
reference.upgrade().unwrap().add_tooltip("equip", gui);
|
reference.upgrade().unwrap().add_tooltip("equip", gui);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
reference.upgrade().unwrap().remove_tooltip("equip");
|
reference.upgrade().unwrap().remove_tooltip(world, "equip")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reference.upgrade().unwrap().remove_tooltip("equip");
|
reference.upgrade().unwrap().remove_tooltip(world, "equip")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -120,7 +120,7 @@ impl JewelRightSide {
|
||||||
menu.add_tooltip("upper", tooltip);
|
menu.add_tooltip("upper", tooltip);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
menu.remove_tooltip("upper");
|
menu.remove_tooltip(world, "upper")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -163,7 +163,7 @@ impl JewelRightSide {
|
||||||
menu.add_tooltip(format!("lower_{index}",), tooltip);
|
menu.add_tooltip(format!("lower_{index}",), tooltip);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
menu.remove_tooltip(format!("lower_{index}"));
|
menu.remove_tooltip(world, format!("lower_{index}"))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -234,8 +234,12 @@ impl CharacterWindow {
|
||||||
.insert(name.to_string(), gui.into());
|
.insert(name.to_string(), gui.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_tooltip(&self, name: impl ToString) {
|
pub fn remove_tooltip(&self, world: &mut World, name: impl ToString) -> Result<()> {
|
||||||
self.tooltips.lock().unwrap().remove(&name.to_string());
|
if let Some(tooltip) = self.tooltips.lock().unwrap().remove(&name.to_string()) {
|
||||||
|
tooltip.disable(world)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn salvage_from_inventory<A, F, S>(world: &mut World, hero: Entity, f: F) -> Result<()>
|
pub fn salvage_from_inventory<A, F, S>(world: &mut World, hero: Entity, f: F) -> Result<()>
|
||||||
|
|
Loading…
Reference in a new issue