UI for sword skill tree

Axe skill tree UI

Hammer skill tree UI

Bow skill tree UI

moar renders

Staff skill tree UI

Sceptre skill tree UI
This commit is contained in:
Sam 2020-12-29 11:28:17 -05:00
parent 3f436079e8
commit bde2bc1f77
17 changed files with 2488 additions and 505 deletions

View File

@ -3,7 +3,7 @@ ItemDef(
description: "Shouldn't this be a hammer?",
kind: Tool(
(
kind: Sceptre,
kind: Sword,
stats: (
equip_time_millis: 0,
power: 1000.0,

View File

@ -5,18 +5,18 @@
UnlockGroup(Weapon(Bow)): {General(HealthIncrease): Some(1)},
UnlockGroup(Weapon(Staff)): {General(HealthIncrease): Some(1)},
UnlockGroup(Weapon(Sceptre)): {General(HealthIncrease): Some(1)},
Sword(SDamage): {Sword(SUnlockSpin): None},
Sword(SSpeed): {Sword(SUnlockSpin): None},
Sword(SCost): {Sword(SUnlockSpin): None},
Sword(SSpins): {Sword(SUnlockSpin): None},
Sword(TsDamage): {Sword(TsCombo): None},
Sword(TsRegen): {Sword(TsCombo): None},
Sword(TsSpeed): {Sword(TsCombo): None},
Sword(DDrain): {Sword(DDamage): Some(1)},
Sword(DCost): {Sword(DDamage): Some(1)},
Sword(DSpeed): {Sword(DDamage): Some(1)},
Sword(DInfinite): {Sword(DDamage): Some(1)},
Sword(DScaling): {Sword(DDamage): Some(1)},
Sword(TsDamage): {Sword(TsCombo): None},
Sword(TsRegen): {Sword(TsCombo): None},
Sword(TsSpeed): {Sword(TsCombo): None},
Sword(SDamage): {Sword(SUnlockSpin): None},
Sword(SSpeed): {Sword(SUnlockSpin): None},
Sword(SCost): {Sword(SUnlockSpin): None},
Sword(SSpins): {Sword(SUnlockSpin): None},
Axe(DsDamage): {Axe(DsCombo): None},
Axe(DsSpeed): {Axe(DsCombo): None},
Axe(DsRegen): {Axe(DsCombo): None},

BIN
assets/voxygen/element/misc_bg/axe_render.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/misc_bg/bow_render.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/misc_bg/dagger_render.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/misc_bg/general_combat_render.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/misc_bg/hammer_render.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/misc_bg/sceptre_render.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/misc_bg/shield_render.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/misc_bg/staff0_render.png (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

View File

@ -20,8 +20,10 @@ use common::{
comp::{
self,
chat::{KillSource, KillType},
group, ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip,
InventoryManip, InventoryUpdateEvent,
group,
skills::Skill,
ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip, InventoryManip,
InventoryUpdateEvent,
},
event::{EventBus, LocalEvent},
grid::Grid,
@ -692,6 +694,10 @@ impl Client {
)));
}
pub fn unlock_skill(&mut self, skill: Skill) {
self.send_msg(ClientGeneral::UnlockSkill(skill));
}
pub fn max_group_size(&self) -> u32 { self.max_group_size }
pub fn group_invite(&self) -> Option<(Uid, std::time::Instant, std::time::Duration)> {

2400
voxygen/src/hud/diary.rs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -66,6 +66,14 @@ image_ids! {
diary_bg: "voxygen.element.misc_bg.diary_bg",
diary_frame: "voxygen.element.misc_bg.diary_frame",
sword_render: "voxygen.element.misc_bg.sword_render",
axe_render: "voxygen.element.misc_bg.axe_render",
hammer_render: "voxygen.element.misc_bg.hammer_render",
bow_render: "voxygen.element.misc_bg.bow_render",
staff0_render: "voxygen.element.misc_bg.staff0_render",
sceptre_render: "voxygen.element.misc_bg.sceptre_render",
general_combat_render: "voxygen.element.misc_bg.general_combat_render",
shield_render: "voxygen.element.misc_bg.shield_render",
dagger_render: "voxygen.element.misc_bg.dagger_render",
// Skill Trees
sceptre: "voxygen.element.icons.sceptre",

View File

@ -3,6 +3,7 @@ mod buffs;
mod buttons;
mod chat;
mod crafting;
mod diary;
mod esc_menu;
mod group;
mod hotbar;
@ -18,7 +19,6 @@ mod settings_window;
mod skillbar;
mod slots;
mod social;
mod spell;
mod util;
pub use hotbar::{SlotContents as HotbarSlotContents, State as HotbarState};
@ -31,6 +31,7 @@ use buttons::Buttons;
use chat::Chat;
use chrono::NaiveTime;
use crafting::Crafting;
use diary::{Diary, SelectedSkillTree};
use esc_menu::EscMenu;
use group::Group;
use img_ids::Imgs;
@ -43,7 +44,6 @@ use serde::{Deserialize, Serialize};
use settings_window::{SettingsTab, SettingsWindow};
use skillbar::Skillbar;
use social::{Social, SocialTab};
use spell::{SelectedSkillTree, Spell};
use crate::{
ecs::{comp as vcomp, comp::HpFloaterList},
@ -60,6 +60,7 @@ use common::{
comp,
comp::{
item::{ItemDesc, Quality},
skills::Skill,
BuffKind,
},
span,
@ -246,7 +247,7 @@ widget_ids! {
bag,
social,
quest,
spell,
diary,
skillbar,
buttons,
buffs,
@ -384,6 +385,7 @@ pub enum Event {
LeaveGroup,
AssignLeader(Uid),
RemoveBuff(BuffKind),
UnlockSkill(Skill),
}
// TODO: Are these the possible layouts we want?
@ -453,7 +455,7 @@ pub struct Show {
bag: bool,
bag_inv: bool,
social: bool,
spell: bool,
diary: bool,
group: bool,
group_menu: bool,
esc_menu: bool,
@ -487,7 +489,7 @@ impl Show {
self.bag = false;
self.crafting = false;
self.social = false;
self.spell = false;
self.diary = false;
self.want_grab = !open;
}
}
@ -495,7 +497,7 @@ impl Show {
fn social(&mut self, open: bool) {
if !self.esc_menu {
self.social = open;
self.spell = false;
self.diary = false;
self.want_grab = !open;
}
}
@ -509,13 +511,13 @@ impl Show {
}
}
fn spell(&mut self, open: bool) {
fn diary(&mut self, open: bool) {
if !self.esc_menu {
self.social = false;
self.crafting = false;
self.bag = false;
self.map = false;
self.spell = open;
self.diary = open;
self.want_grab = !open;
}
}
@ -534,7 +536,7 @@ impl Show {
self.bag = false;
self.social = false;
self.crafting = false;
self.spell = false;
self.diary = false;
self.want_grab = !open;
}
}
@ -566,7 +568,7 @@ impl Show {
|| self.map
|| self.social
|| self.crafting
|| self.spell
|| self.diary
|| self.help
|| self.intro
|| !matches!(self.open_windows, Windows::None)
@ -577,7 +579,7 @@ impl Show {
self.intro = false;
self.map = false;
self.social = false;
self.spell = false;
self.diary = false;
self.crafting = false;
self.open_windows = Windows::None;
self.want_grab = true;
@ -605,23 +607,23 @@ impl Show {
fn toggle_social(&mut self) {
self.social(!self.social);
self.spell = false;
self.diary = false;
}
fn toggle_crafting(&mut self) { self.crafting(!self.crafting) }
fn open_social_tab(&mut self, social_tab: SocialTab) {
self.social_tab = social_tab;
self.spell = false;
self.diary = false;
}
fn toggle_spell(&mut self) {
self.spell = !self.spell;
self.diary = !self.diary;
self.bag = false;
self.crafting = false;
self.social = false;
self.map = false;
self.want_grab = !self.spell;
self.want_grab = !self.diary;
}
fn open_skill_tree(&mut self, tree_sel: SelectedSkillTree) {
@ -750,7 +752,7 @@ impl Hud {
crafting: false,
ui: true,
social: false,
spell: false,
diary: false,
group: false,
group_menu: false,
mini_map: true,
@ -2304,18 +2306,27 @@ impl Hud {
}
}
// Spellbook
if self.show.spell {
for event in Spell::new(&self.show, client, &self.imgs, &self.fonts, i18n)
.set(self.ids.spell, ui_widgets)
// Diary
if self.show.diary {
for event in Diary::new(
&self.show,
client,
&self.imgs,
&self.fonts,
i18n,
&self.rot_imgs,
tooltip_manager,
)
.set(self.ids.diary, ui_widgets)
{
match event {
spell::Event::Close => {
self.show.spell(false);
diary::Event::Close => {
self.show.diary(false);
self.show.want_grab = true;
self.force_ungrab = false;
},
spell::Event::ChangeWeaponTree(tree_sel) => self.show.open_skill_tree(tree_sel),
diary::Event::ChangeWeaponTree(tree_sel) => self.show.open_skill_tree(tree_sel),
diary::Event::UnlockSkill(skill) => events.push(Event::UnlockSkill(skill)),
}
}
}

View File

@ -1,470 +0,0 @@
use super::{img_ids::Imgs, Show, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN};
use crate::{i18n::Localization, ui::fonts::Fonts};
use conrod_core::{
color,
widget::{self, Button, Image, Rectangle, Text},
widget_ids, Color, Colorable, Labelable, Positionable, Sizeable, Widget, WidgetCommon,
};
use client::{self, Client};
use inline_tweak::*;
widget_ids! {
pub struct Ids {
frame,
bg,
icon,
close,
title,
content_align,
weapon_imgs[],
weapon_btns[],
skills_top_l_align,
skills_top_r_align,
skills_bot_l_align,
skills_bot_r_align,
skills_top_l[],
skills_top_r[],
skills_bot_l[],
skills_bot_r[],
sword_render,
sword_skill_0,
sword_sill_1,
}
}
#[derive(WidgetCommon)]
pub struct Spell<'a> {
show: &'a Show,
_client: &'a Client,
imgs: &'a Imgs,
fonts: &'a Fonts,
localized_strings: &'a Localization,
#[conrod(common_builder)]
common: widget::CommonBuilder,
created_btns_top_l: usize,
created_btns_top_r: usize,
created_btns_bot_l: usize,
created_btns_bot_r: usize,
example_skill_count: usize,
}
impl<'a> Spell<'a> {
pub fn new(
show: &'a Show,
_client: &'a Client,
imgs: &'a Imgs,
fonts: &'a Fonts,
localized_strings: &'a Localization,
) -> Self {
Self {
show,
_client,
imgs,
fonts,
localized_strings,
common: widget::CommonBuilder::default(),
created_btns_top_l: 0,
created_btns_top_r: 0,
created_btns_bot_l: 0,
created_btns_bot_r: 0,
example_skill_count: 0,
}
}
}
/*pub struct State {
ids: Ids,
}*/
/*pub enum DiaryTab {
SkillTrees,
Achievements,
}*/
pub enum SelectedSkillTree {
None,
Sword,
Hammer,
Axe,
Sceptre,
Bow,
StaffFire,
}
const WEAPONS: [&str; 6] = ["Sword", "Hammer", "Axe", "Sceptre", "Bow", "Fire Staff"];
pub enum Event {
Close,
ChangeWeaponTree(SelectedSkillTree),
}
impl<'a> Widget for Spell<'a> {
type Event = Vec<Event>;
type State = Ids;
type Style = ();
fn init_state(&self, id_gen: widget::id::Generator) -> Self::State { Ids::new(id_gen) }
#[allow(clippy::unused_unit)] // TODO: Pending review in #587
fn style(&self) -> Self::Style { () }
fn update(mut self, args: widget::UpdateArgs<Self>) -> Self::Event {
let widget::UpdateArgs {
id: _, state, ui, ..
} = args;
let mut events = Vec::new();
let sel_tab = &self.show.skilltreetab;
// Frame
Image::new(self.imgs.diary_bg)
.w_h(1202.0, 886.0)
.mid_top_with_margin_on(ui.window, 5.0)
.color(Some(UI_MAIN))
.set(state.bg, ui);
Image::new(self.imgs.diary_frame)
.w_h(1202.0, 886.0)
.middle_of(state.bg)
.color(Some(UI_HIGHLIGHT_0))
.set(state.frame, ui);
// Icon
Image::new(self.imgs.spellbook_button)
.w_h(30.0, 27.0)
.top_left_with_margins_on(state.frame, 8.0, 8.0)
.set(state.icon, ui);
// X-Button
if Button::image(self.imgs.close_button)
.w_h(24.0, 25.0)
.hover_image(self.imgs.close_btn_hover)
.press_image(self.imgs.close_btn_press)
.top_right_with_margins_on(state.frame, 0.0, 0.0)
.set(state.close, ui)
.was_clicked()
{
events.push(Event::Close);
}
// Title
Text::new(&self.localized_strings.get("hud.diary"))
.mid_top_with_margin_on(state.frame, 3.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(29))
.color(TEXT_COLOR)
.set(state.title, ui);
// Content Alignment
Rectangle::fill_with([599.0 * 2.0, 419.0 * 2.0], color::TRANSPARENT)
.mid_top_with_margin_on(state.frame, 46.0)
.set(state.content_align, ui);
// Contents
// Skill Trees
// Skill Tree Selection
state.update(|s| {
s.weapon_btns
.resize(WEAPONS.len(), &mut ui.widget_id_generator())
});
state.update(|s| {
s.weapon_imgs
.resize(WEAPONS.len(), &mut ui.widget_id_generator())
});
for i in WEAPONS.iter().copied().enumerate() {
// Background weapon image
let img = Image::new(match i.1 {
"Sword" => self.imgs.sword,
"Hammer" => self.imgs.hammer,
"Axe" => self.imgs.axe,
"Sceptre" => self.imgs.sceptre,
"Bow" => self.imgs.bow,
"Fire Staff" => self.imgs.staff,
_ => self.imgs.nothing,
});
let img = if i.0 == 0 {
img.top_left_with_margins_on(state.content_align, tweak!(10.0), tweak!(5.0))
} else {
img.down_from(state.weapon_btns[i.0 - 1], tweak!(5.0))
};
img.w_h(tweak!(50.0), tweak!(50.0))
.set(state.weapon_imgs[i.0], ui);
// Weapon icons
if Button::image(match i.1 {
"Sword" => match sel_tab {
SelectedSkillTree::Sword => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border,
},
"Hammer" => match sel_tab {
SelectedSkillTree::Hammer => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border,
},
"Axe" => match sel_tab {
SelectedSkillTree::Axe => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border,
},
"Sceptre" => match sel_tab {
SelectedSkillTree::Sceptre => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border,
},
"Bow" => match sel_tab {
SelectedSkillTree::Bow => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border,
},
"Fire Staff" => match sel_tab {
SelectedSkillTree::StaffFire => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border,
},
_ => self.imgs.wpn_icon_border,
})
.w_h(tweak!(50.0), tweak!(50.0))
.hover_image(match i.1 {
"Sword" => match sel_tab {
SelectedSkillTree::Sword => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_mo,
},
"Hammer" => match sel_tab {
SelectedSkillTree::Hammer => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_mo,
},
"Axe" => match sel_tab {
SelectedSkillTree::Axe => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_mo,
},
"Sceptre" => match sel_tab {
SelectedSkillTree::Sceptre => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_mo,
},
"Bow" => match sel_tab {
SelectedSkillTree::Bow => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_mo,
},
"Fire Staff" => match sel_tab {
SelectedSkillTree::StaffFire => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_mo,
},
_ => self.imgs.wpn_icon_border,
})
.press_image(match i.1 {
"Sword" => match sel_tab {
SelectedSkillTree::Sword => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_press,
},
"Hammer" => match sel_tab {
SelectedSkillTree::Hammer => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_press,
},
"Axe" => match sel_tab {
SelectedSkillTree::Axe => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_press,
},
"Sceptre" => match sel_tab {
SelectedSkillTree::Sceptre => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_press,
},
"Bow" => match sel_tab {
SelectedSkillTree::Bow => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_press,
},
"Fire Staff" => match sel_tab {
SelectedSkillTree::StaffFire => self.imgs.wpn_icon_border_pressed,
_ => self.imgs.wpn_icon_border_press,
},
_ => self.imgs.wpn_icon_border,
})
.middle_of(state.weapon_imgs[i.0])
.set(state.weapon_btns[i.0], ui)
.was_clicked()
{
match i.1 {
"Sword" => events.push(Event::ChangeWeaponTree(SelectedSkillTree::Sword)),
"Hammer" => events.push(Event::ChangeWeaponTree(SelectedSkillTree::Hammer)),
"Axe" => events.push(Event::ChangeWeaponTree(SelectedSkillTree::Axe)),
"Sceptre" => events.push(Event::ChangeWeaponTree(SelectedSkillTree::Sceptre)),
"Bow" => events.push(Event::ChangeWeaponTree(SelectedSkillTree::Bow)),
"Fire Staff" => {
events.push(Event::ChangeWeaponTree(SelectedSkillTree::StaffFire))
},
_ => events.push(Event::ChangeWeaponTree(SelectedSkillTree::None)),
}
}
}
// Skill Trees
// Alignment Placing
let x = tweak!(200.0);
let y = tweak!(100.0);
// Alignment rectangles for skills
Rectangle::fill_with([124.0 * 2.0, 124.0 * 2.0], color::TRANSPARENT)
.top_left_with_margins_on(state.content_align, y, x)
.set(state.skills_top_l_align, ui);
Rectangle::fill_with([124.0 * 2.0, 124.0 * 2.0], color::TRANSPARENT)
.top_right_with_margins_on(state.content_align, y, x)
.set(state.skills_top_r_align, ui);
Rectangle::fill_with([124.0 * 2.0, 124.0 * 2.0], color::TRANSPARENT)
.bottom_left_with_margins_on(state.content_align, y, x)
.set(state.skills_bot_l_align, ui);
Rectangle::fill_with([124.0 * 2.0, 124.0 * 2.0], color::TRANSPARENT)
.bottom_right_with_margins_on(state.content_align, y, x)
.set(state.skills_bot_r_align, ui);
// Number of skills per rectangle per weapon, start counting at 0
// Maximum of 9 skills/8 indices
let skills_top_l = match sel_tab {
SelectedSkillTree::Sword => 4,
SelectedSkillTree::Bow => 1,
_ => 0,
};
let skills_top_r = match sel_tab {
SelectedSkillTree::Sword => 5,
_ => 0,
};
let skills_bot_l = match sel_tab {
SelectedSkillTree::Sword => 3,
SelectedSkillTree::Bow => 2,
_ => 0,
};
let skills_bot_r = match sel_tab {
SelectedSkillTree::Sword => 1,
_ => 0,
};
// Update widget id array len
state.update(|s| {
s.skills_top_l
.resize(skills_top_l, &mut ui.widget_id_generator())
});
state.update(|s| {
s.skills_top_r
.resize(skills_top_r, &mut ui.widget_id_generator())
});
state.update(|s| {
s.skills_bot_l
.resize(skills_bot_l, &mut ui.widget_id_generator())
});
state.update(|s| {
s.skills_bot_r
.resize(skills_bot_r, &mut ui.widget_id_generator())
});
// Create Background Images to place skill icons on them later
// Create central skill first, others around it:
//
// 5 1 6
// 3 0 4
// 8 2 7
//
//
// TOP-LEFT Skills
while self.created_btns_top_l < skills_top_l {
let mut img = Button::image(self.imgs.wpn_icon_border).w_h(80.0, 80.0);
match self.created_btns_top_l {
0 => img = img.middle_of(state.skills_top_l_align), // Central Skill
1 => img = img.up_from(state.skills_top_l[0], 4.0), // 12:00
2 => img = img.down_from(state.skills_top_l[0], 4.0), // 6:00
3 => img = img.left_from(state.skills_top_l[0], 4.0), // 3:00
4 => img = img.right_from(state.skills_top_l[0], 4.0), // 9:00
5 => img = img.top_left_with_margins_on(state.skills_top_l[0], -41.0, -41.0), /* 10:30 */
6 => img = img.top_right_with_margins_on(state.skills_top_l[0], -41.0, -41.0), /* 1:30 */
7 => img = img.bottom_left_with_margins_on(state.skills_top_l[0], -41.0, -41.0), /* 4:30 */
8 => img = img.bottom_right_with_margins_on(state.skills_top_l[0], -41.0, -41.0), /* 7:30 */
_ => {},
}
img.set(state.skills_top_l[self.created_btns_top_l], ui);
self.created_btns_top_l = self.created_btns_top_l + 1;
}
// TOP-RIGHT Skills
while self.created_btns_top_r < skills_top_r {
let mut img = Button::image(self.imgs.wpn_icon_border).w_h(80.0, 80.0);
match self.created_btns_top_r {
0 => img = img.middle_of(state.skills_top_r_align), // Central Skill
1 => img = img.up_from(state.skills_top_r[0], 4.0), // 12:00
2 => img = img.down_from(state.skills_top_r[0], 4.0), // 6:00
3 => img = img.left_from(state.skills_top_r[0], 4.0), // 3:00
4 => img = img.right_from(state.skills_top_r[0], 4.0), // 9:00
5 => img = img.top_left_with_margins_on(state.skills_top_r[0], -41.0, -41.0), /* 10:30 */
6 => img = img.top_right_with_margins_on(state.skills_top_r[0], -41.0, -41.0), /* 1:30 */
7 => img = img.bottom_left_with_margins_on(state.skills_top_r[0], -41.0, -41.0), /* 4:30 */
8 => img = img.bottom_right_with_margins_on(state.skills_top_r[0], -41.0, -41.0), /* 7:30 */
_ => {},
}
img.set(state.skills_top_r[self.created_btns_top_r], ui);
self.created_btns_top_r = self.created_btns_top_r + 1;
}
// BOTTOM-LEFT Skills
while self.created_btns_bot_l < skills_bot_l {
let mut img = Button::image(self.imgs.wpn_icon_border).w_h(80.0, 80.0);
match self.created_btns_bot_l {
0 => img = img.middle_of(state.skills_bot_l_align), // Central Skill
1 => img = img.up_from(state.skills_bot_l[0], 4.0), // 12:00
2 => img = img.down_from(state.skills_bot_l[0], 4.0), // 6:00
3 => img = img.left_from(state.skills_bot_l[0], 4.0), // 3:00
4 => img = img.right_from(state.skills_bot_l[0], 4.0), // 9:00
5 => img = img.top_left_with_margins_on(state.skills_bot_l[0], -41.0, -41.0), /* 10:30 */
6 => img = img.top_right_with_margins_on(state.skills_bot_l[0], -41.0, -41.0), /* 1:30 */
7 => img = img.bottom_left_with_margins_on(state.skills_bot_l[0], -41.0, -41.0), /* 4:30 */
8 => img = img.bottom_right_with_margins_on(state.skills_bot_l[0], -41.0, -41.0), /* 7:30 */
_ => {},
}
img.set(state.skills_bot_l[self.created_btns_bot_l], ui);
self.created_btns_bot_l = self.created_btns_bot_l + 1;
}
// BOTTOM-RIGHT Skills
while self.created_btns_bot_r < skills_bot_r {
let mut btn = Image::new(self.imgs.wpn_icon_border).w_h(80.0, 80.0);
match self.created_btns_bot_r {
0 => btn = btn.middle_of(state.skills_bot_r_align), // Central Skill
1 => btn = btn.up_from(state.skills_bot_r[0], 4.0), // 12:00
2 => btn = btn.down_from(state.skills_bot_r[0], 4.0), // 6:00
3 => btn = btn.left_from(state.skills_bot_r[0], 4.0), // 3:00
4 => btn = btn.right_from(state.skills_bot_r[0], 4.0), // 9:00
5 => btn = btn.top_left_with_margins_on(state.skills_bot_r[0], -41.0, -41.0), /* 10:30 */
6 => btn = btn.top_right_with_margins_on(state.skills_bot_r[0], -41.0, -41.0), /* 1:30 */
7 => btn = btn.bottom_left_with_margins_on(state.skills_bot_r[0], -41.0, -41.0), /* 4:30 */
8 => btn = btn.bottom_right_with_margins_on(state.skills_bot_r[0], -41.0, -41.0), /* 7:30 */
_ => {},
}
btn.set(state.skills_bot_r[self.created_btns_bot_r], ui);
self.created_btns_bot_r = self.created_btns_bot_r + 1;
}
// Actual Skill-Icons and Functionality
match sel_tab {
SelectedSkillTree::Sword => {
// Sword
// fancy bg art
let art_scale = tweak!(0.6);
Image::new(self.imgs.sword_render)
.w_h(222.0 * art_scale, 818.0 * art_scale)
.middle_of(state.content_align)
.graphics_for(state.content_align)
.color(Some(Color::Rgba(1.0, 1.0, 1.0, tweak!(0.2))))
.set(state.sword_render, ui);
// Top Left skills
// 5 1 6
// 3 0 4
// 8 2 7
if Button::image(self.imgs.sword_whirlwind)
.w_h(tweak!(74.0), tweak!(74.0))
.middle_of(state.skills_top_l[0])
.label(&self.example_skill_count.to_string())
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
.label_color(TEXT_COLOR)
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
.label_font_id(self.fonts.cyri.conrod_id)
.floating(true)
.set(state.sword_skill_0, ui)
.was_clicked()
{
self.example_skill_count = self.example_skill_count + 1;
};
},
_ => {},
}
events
}
}

View File

@ -926,6 +926,10 @@ impl PlayState for SessionState {
let mut client = self.client.borrow_mut();
client.remove_buff(buff_id);
},
HudEvent::UnlockSkill(skill) => {
let mut client = self.client.borrow_mut();
client.unlock_skill(skill);
},
HudEvent::UseSlot {
slot,
bypass_dialog,