Implement tool tip builder
This commit is contained in:
parent
380c465369
commit
4226d72b1d
6 changed files with 18 additions and 8 deletions
|
@ -12,7 +12,7 @@ use rpg_components::config::abilities::AbilitySettings;
|
|||
use rpg_components::config::attributes::AttributeSettings;
|
||||
use rpg_components::config::experience::ExperienceSettings;
|
||||
use rpg_components::config::items::ItemSettings;
|
||||
use rpg_components::items::ItemSystem;
|
||||
use rpg_components::items::{ItemSystem, ToolTipBuilder};
|
||||
|
||||
// std
|
||||
use std::collections::HashMap;
|
||||
|
@ -101,6 +101,16 @@ impl GameHandle {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToolTipBuilder for GameHandle {
|
||||
fn asset_path(&self, s: &str) -> AssetPath {
|
||||
self.build_data_path(s)
|
||||
}
|
||||
|
||||
fn gui_handler(&self) -> Arc<GuiHandler> {
|
||||
self.upgrade().engine().gui_handler().clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Settings {
|
||||
pub core_settings: CoreSettings,
|
||||
pub user_settings: UserSettings,
|
||||
|
|
|
@ -278,7 +278,7 @@ impl AbilityAddon {
|
|||
position: (i32, i32),
|
||||
) -> Result<Tooltip> {
|
||||
let gui = GuiBuilder::new(
|
||||
tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.asset_path("gui/xml/ingame/loot/addon_snippet.xml"),
|
||||
)?;
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ impl AbilityBook {
|
|||
position: (i32, i32),
|
||||
) -> Result<Tooltip> {
|
||||
let gui = GuiBuilder::new(
|
||||
tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.asset_path("gui/xml/ingame/loot/book_snippet.xml"),
|
||||
)?;
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ impl Item {
|
|||
let count = stats.len() + jewels.len();
|
||||
|
||||
let inspector_snippet = GuiBuilder::new(
|
||||
tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.asset_path(&format!("gui/xml/ingame/loot/items/slots_{}.xml", count)),
|
||||
)?;
|
||||
|
||||
|
@ -269,7 +269,7 @@ impl Item {
|
|||
|
||||
for stat in stats {
|
||||
let stat_type_snippet = GuiSnippet::new(
|
||||
tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.asset_path("gui/xml/ingame/loot/snippets/stat_type_snippet.xml"),
|
||||
)?;
|
||||
|
||||
|
@ -286,7 +286,7 @@ impl Item {
|
|||
|
||||
for jewel in jewels {
|
||||
let socket_snippet = GuiSnippet::new(
|
||||
tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.asset_path("gui/xml/ingame/loot/snippets/item_socket_snippet.xml"),
|
||||
)?;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ impl Jewel {
|
|||
position: (i32, i32),
|
||||
) -> Result<Tooltip> {
|
||||
let inspector_snippet: Arc<GuiBuilder> = GuiBuilder::new(
|
||||
tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.gui_handler(),
|
||||
&tooltip_builder.asset_path("gui/xml/ingame/loot/jewel_tooltip.xml"),
|
||||
)?;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::sync::Arc;
|
|||
|
||||
pub trait ToolTipBuilder {
|
||||
fn asset_path(&self, s: &str) -> AssetPath;
|
||||
fn gui_handler(&self) -> &Arc<GuiHandler>;
|
||||
fn gui_handler(&self) -> Arc<GuiHandler>;
|
||||
}
|
||||
|
||||
pub struct FittingResult {
|
||||
|
|
Loading…
Reference in a new issue