diff --git a/Cargo.toml b/Cargo.toml index ef61b0a..ffe1c31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,9 @@ members = [ "scene_update_macros", "transaction_derive", "map", - "rpg_components", "entity_manager", + "rpg_components", + "entity_manager", + "character_window", ] [workspace.dependencies] diff --git a/character_window/Cargo.toml b/character_window/Cargo.toml new file mode 100644 index 0000000..85b4138 --- /dev/null +++ b/character_window/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "character_window" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = { workspace = true } +paste = { workspace = true } +destructure_traitobject = { workspace = true } + +engine = { path = "../engine" } +rpg_components = { path = "../rpg_components" } \ No newline at end of file diff --git a/character_window/resources/menu.xml b/character_window/resources/menu.xml new file mode 100644 index 0000000..c42201d --- /dev/null +++ b/character_window/resources/menu.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/character_window/resources/statistics.xml b/character_window/resources/statistics.xml new file mode 100644 index 0000000..b3c803d --- /dev/null +++ b/character_window/resources/statistics.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/character_window/src/abilities/ability_right_side.rs b/character_window/src/abilities/ability_right_side.rs new file mode 100644 index 0000000..b4e5fa2 --- /dev/null +++ b/character_window/src/abilities/ability_right_side.rs @@ -0,0 +1,265 @@ +use std::sync::{Arc, Weak}; + +use rpg_components::components::ability_slots::AbilitySlots; +use rpg_components::components::crafting_materials::CraftingMaterials; +use rpg_components::components::inventory::Storable; +use rpg_components::components::statistics::Statistics; +use rpg_components::items::Rarities; + +use crate::*; + +use crate::{traits::RightSide, CharacterWindow}; + +pub struct AbilityPageRightSide { + snippet: Arc, + + ability_index: usize, +} + +impl AbilityPageRightSide { + const ABILITY_BUTTON_NAMES: [&'static str; 4] = [ + "first_ability", + "second_ability", + "third_ability", + "fourth_ability", + ]; + + pub fn new( + game_handle: &GameHandle, + reference: &Weak, + hero: Entity, + ) -> Result { + let snippet = + game_handle.gui_snippet("gui/xml/ingame/character_menu/abilities/right_side.xml")?; + + let game = game_handle.upgrade(); + let color_settings = &game.item_settings.rarity_color_settings; + + Self::rarity_icon_background(&snippet, "common", color_settings.common)?; + Self::rarity_icon_background(&snippet, "uncommon", color_settings.uncommon)?; + Self::rarity_icon_background(&snippet, "magical", color_settings.magical)?; + Self::rarity_icon_background(&snippet, "rare", color_settings.rare)?; + Self::rarity_icon_background(&snippet, "epic", color_settings.epic)?; + Self::rarity_icon_background(&snippet, "legendary", color_settings.legendary)?; + + for (index, name) in Self::ABILITY_BUTTON_NAMES.iter().enumerate() { + let button: Arc