mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
removed character window and questlog
This commit is contained in:
parent
b9f61d4e7a
commit
2e41b59282
BIN
assets/voxygen/element/misc_bg/inv_runes.png
(Stored with Git LFS)
BIN
assets/voxygen/element/misc_bg/inv_runes.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/misc_bg/inv_slots.png
(Stored with Git LFS)
BIN
assets/voxygen/element/misc_bg/inv_slots.png
(Stored with Git LFS)
Binary file not shown.
@ -194,18 +194,6 @@ impl<'a> Widget for Bag<'a> {
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.inventory_title, ui);
|
||||
|
||||
// Close button
|
||||
if Button::image(self.imgs.close_btn)
|
||||
.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.ids.bg, 0.0, 0.0)
|
||||
.set(state.ids.bag_close, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
event = Some(Event::Close);
|
||||
}
|
||||
|
||||
// Scrollbar-BG
|
||||
Image::new(self.imgs.scrollbar_bg)
|
||||
.w_h(9.0, 173.0)
|
||||
@ -229,13 +217,13 @@ impl<'a> Widget for Bag<'a> {
|
||||
//Armor Slots
|
||||
//Slots BG
|
||||
Image::new(self.imgs.inv_runes)
|
||||
.w_h(424.0, 708.0)
|
||||
.middle_of(state.ids.bg)
|
||||
.w_h(424.0, 454.0)
|
||||
.mid_top_with_margin_on(state.ids.bg, 0.0)
|
||||
.color(Some(UI_HIGHLIGHT_0))
|
||||
.set(state.ids.slots_bg, ui);
|
||||
Image::new(self.imgs.inv_slots)
|
||||
.w_h(424.0, 708.0)
|
||||
.middle_of(state.ids.bg)
|
||||
.w_h(424.0, 401.0)
|
||||
.mid_top_with_margin_on(state.ids.bg, 57.0)
|
||||
.color(Some(UI_HIGHLIGHT_0))
|
||||
.set(state.ids.slots_bg, ui);
|
||||
} else {
|
||||
@ -466,7 +454,17 @@ impl<'a> Widget for Bag<'a> {
|
||||
.set(state.ids.tab_4, ui)
|
||||
.was_clicked()
|
||||
{}
|
||||
|
||||
// Close button
|
||||
if Button::image(self.imgs.close_btn)
|
||||
.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.ids.bg, 0.0, 0.0)
|
||||
.set(state.ids.bag_close, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
event = Some(Event::Close);
|
||||
}
|
||||
event
|
||||
}
|
||||
}
|
||||
|
@ -1,402 +0,0 @@
|
||||
use super::{img_ids::Imgs, Show, TEXT_COLOR, XP_COLOR};
|
||||
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts};
|
||||
use common::comp::Stats;
|
||||
use conrod_core::{
|
||||
color,
|
||||
widget::{self, Button, Image, Rectangle, Text},
|
||||
widget_ids, Color, Colorable, Positionable, Sizeable, Widget, WidgetCommon,
|
||||
};
|
||||
|
||||
widget_ids! {
|
||||
pub struct Ids {
|
||||
charwindow,
|
||||
charwindow_gradient,
|
||||
charwindow_close,
|
||||
charwindow_exp_progress_rectangle,
|
||||
charwindow_exp_rectangle,
|
||||
charwindow_frame,
|
||||
content_align,
|
||||
charwindow_rectangle,
|
||||
charwindow_tab1,
|
||||
charwindow_tab1_exp,
|
||||
charwindow_tab1_expbar,
|
||||
charwindow_tab1_level,
|
||||
charwindow_tab1_statnames,
|
||||
charwindow_tab1_stats,
|
||||
charwindow_tab_bg,
|
||||
charwindow_title,
|
||||
window_3,
|
||||
tab_bg,
|
||||
tab_small_open,
|
||||
tab_small_closed,
|
||||
xp_charwindow,
|
||||
divider,
|
||||
head_bg,
|
||||
shoulders_bg,
|
||||
hands_bg,
|
||||
belt_bg,
|
||||
legs_bg,
|
||||
feet_bg,
|
||||
ring_r_bg,
|
||||
ring_l_bg,
|
||||
tabard_bg,
|
||||
chest_bg,
|
||||
back_bg,
|
||||
gem_bg,
|
||||
necklace_bg,
|
||||
mainhand_bg,
|
||||
offhand_bg,
|
||||
charwindow_bg,
|
||||
head_grid,
|
||||
shoulders_grid,
|
||||
hands_grid,
|
||||
belt_grid,
|
||||
legs_grid,
|
||||
feet_grid,
|
||||
ring_r_grid,
|
||||
ring_l_grid,
|
||||
tabard_grid,
|
||||
chest_grid,
|
||||
back_grid,
|
||||
gem_grid,
|
||||
necklace_grid,
|
||||
mainhand_grid,
|
||||
offhand_grid,
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(WidgetCommon)]
|
||||
pub struct CharacterWindow<'a> {
|
||||
_show: &'a Show,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
stats: &'a Stats,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
}
|
||||
|
||||
impl<'a> CharacterWindow<'a> {
|
||||
pub fn new(
|
||||
_show: &'a Show,
|
||||
stats: &'a Stats,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
) -> Self {
|
||||
Self {
|
||||
_show,
|
||||
imgs,
|
||||
fonts,
|
||||
stats,
|
||||
localized_strings,
|
||||
common: widget::CommonBuilder::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum Event {
|
||||
Close,
|
||||
}
|
||||
|
||||
impl<'a> Widget for CharacterWindow<'a> {
|
||||
type Event = Option<Event>;
|
||||
type State = Ids;
|
||||
type Style = ();
|
||||
|
||||
fn init_state(&self, id_gen: widget::id::Generator) -> Self::State { Ids::new(id_gen) }
|
||||
|
||||
fn style(&self) -> Self::Style { () }
|
||||
|
||||
fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
|
||||
let widget::UpdateArgs { id, state, ui, .. } = args;
|
||||
|
||||
let exp_percentage = (self.stats.exp.current() as f64) / (self.stats.exp.maximum() as f64);
|
||||
let exp_treshold = format!("{}/{}", self.stats.exp.current(), self.stats.exp.maximum());
|
||||
let level = (self.stats.level.level()).to_string();
|
||||
|
||||
// Frame
|
||||
Image::new(self.imgs.window_3)
|
||||
.middle_of(id)
|
||||
.top_left_with_margins_on(ui.window, 200.0, 215.0)
|
||||
.w_h(103.0 * 4.0, 122.0 * 4.0)
|
||||
.set(state.charwindow_frame, ui);
|
||||
|
||||
// Icon
|
||||
//Image::new(self.imgs.charwindow_icon)
|
||||
//.w_h(40.0, 40.0)
|
||||
//.top_left_with_margins_on(state.charwindow_frame, 4.0, 4.0)
|
||||
//.set(state.charwindow_icon, ui);
|
||||
|
||||
// X-Button
|
||||
if Button::image(self.imgs.close_button)
|
||||
.w_h(28.0, 28.0)
|
||||
.hover_image(self.imgs.close_button_hover)
|
||||
.press_image(self.imgs.close_button_press)
|
||||
.top_right_with_margins_on(state.charwindow_frame, 0.0, 0.0)
|
||||
.set(state.charwindow_close, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
return Some(Event::Close);
|
||||
}
|
||||
|
||||
// Title
|
||||
// TODO: Use an actual character name.
|
||||
Text::new(
|
||||
&self
|
||||
.localized_strings
|
||||
.get("character_window.character_name"),
|
||||
)
|
||||
.mid_top_with_margin_on(state.charwindow_frame, 6.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.charwindow_title, ui);
|
||||
|
||||
// Content Alignment
|
||||
Rectangle::fill_with([95.0 * 4.0, 108.0 * 4.0], color::TRANSPARENT)
|
||||
.mid_top_with_margin_on(state.charwindow_frame, 40.0)
|
||||
.set(state.content_align, ui);
|
||||
|
||||
// Gradient BG
|
||||
Image::new(self.imgs.charwindow_gradient)
|
||||
.w_h(95.0 * 4.0, 108.0 * 4.0)
|
||||
.middle_of(state.content_align)
|
||||
.set(state.charwindow_gradient, ui);
|
||||
|
||||
// Contents
|
||||
|
||||
// Head
|
||||
Image::new(self.imgs.head_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.mid_top_with_margin_on(state.content_align, 5.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.head_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.head_bg)
|
||||
.set(state.head_grid, ui);
|
||||
|
||||
// Ring R
|
||||
Image::new(self.imgs.ring_r_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.bottom_right_with_margins_on(state.content_align, 20.0, 20.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.ring_r_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.ring_r_bg)
|
||||
.set(state.ring_r_grid, ui);
|
||||
// Feet
|
||||
Image::new(self.imgs.feet_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.up_from(state.ring_r_bg, 10.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.feet_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.feet_bg)
|
||||
.set(state.feet_grid, ui);
|
||||
// Legs
|
||||
Image::new(self.imgs.legs_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.up_from(state.feet_bg, 10.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.legs_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.legs_bg)
|
||||
.set(state.legs_grid, ui);
|
||||
// Belt
|
||||
Image::new(self.imgs.belt_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.up_from(state.legs_bg, 10.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.belt_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.belt_bg)
|
||||
.set(state.belt_grid, ui);
|
||||
// Hands
|
||||
Image::new(self.imgs.hands_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.up_from(state.belt_bg, 10.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.hands_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.hands_bg)
|
||||
.set(state.hands_grid, ui);
|
||||
// Shoulders
|
||||
Image::new(self.imgs.shoulders_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.up_from(state.hands_bg, 10.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.shoulders_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.shoulders_bg)
|
||||
.set(state.shoulders_grid, ui);
|
||||
// Ring L
|
||||
Image::new(self.imgs.ring_l_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.bottom_left_with_margins_on(state.content_align, 20.0, 20.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.ring_l_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.ring_l_bg)
|
||||
.set(state.ring_l_grid, ui);
|
||||
// Tabard
|
||||
Image::new(self.imgs.tabard_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.up_from(state.ring_l_bg, 10.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.tabard_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.tabard_bg)
|
||||
.set(state.tabard_grid, ui);
|
||||
// Chest
|
||||
Image::new(self.imgs.chest_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.up_from(state.tabard_bg, 10.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.chest_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.chest_bg)
|
||||
.set(state.chest_grid, ui);
|
||||
// Back
|
||||
Image::new(self.imgs.back_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.up_from(state.chest_bg, 10.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.back_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.back_bg)
|
||||
.set(state.back_grid, ui);
|
||||
// Gem
|
||||
Image::new(self.imgs.gem_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.up_from(state.back_bg, 10.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.gem_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.gem_bg)
|
||||
.set(state.gem_grid, ui);
|
||||
// Necklace
|
||||
Image::new(self.imgs.necklace_bg)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.up_from(state.gem_bg, 10.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.necklace_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 1.8, 28.0 * 1.8)
|
||||
.middle_of(state.necklace_bg)
|
||||
.set(state.necklace_grid, ui);
|
||||
|
||||
// Weapon Main Hand
|
||||
Image::new(self.imgs.mainhand_bg)
|
||||
.w_h(28.0 * 2.2, 28.0 * 2.2)
|
||||
.bottom_right_with_margins_on(state.ring_l_bg, 0.0, -115.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.mainhand_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 2.2, 28.0 * 2.2)
|
||||
.middle_of(state.mainhand_bg)
|
||||
.set(state.mainhand_grid, ui);
|
||||
// Weapon Off-Hand
|
||||
Image::new(self.imgs.offhand_bg)
|
||||
.w_h(28.0 * 2.2, 28.0 * 2.2)
|
||||
.bottom_left_with_margins_on(state.ring_r_bg, 0.0, -115.0)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, 0.1)))
|
||||
.set(state.offhand_bg, ui);
|
||||
Button::image(self.imgs.grid)
|
||||
.w_h(28.0 * 2.2, 28.0 * 2.2)
|
||||
.middle_of(state.offhand_bg)
|
||||
.set(state.offhand_grid, ui);
|
||||
|
||||
// Stats Tab
|
||||
|
||||
// Tab BG
|
||||
Image::new(self.imgs.tab_bg)
|
||||
.w_h(51.0 * 4.0, 115.0 * 4.0)
|
||||
.top_left_with_margins_on(state.charwindow_frame, 28.0, -200.0)
|
||||
.set(state.charwindow_tab_bg, ui);
|
||||
|
||||
// Tab Rectangle
|
||||
Rectangle::fill_with([45.0 * 4.0, 104.0 * 4.0], color::TRANSPARENT)
|
||||
.top_left_with_margins_on(state.charwindow_tab_bg, 7.0 * 4.0, 4.0 * 4.0)
|
||||
.set(state.charwindow_rectangle, ui);
|
||||
|
||||
// Level
|
||||
Text::new(&level)
|
||||
.mid_top_with_margin_on(state.charwindow_rectangle, 10.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(30))
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.charwindow_tab1_level, ui);
|
||||
|
||||
// Exp-Bar Background
|
||||
Rectangle::fill_with([170.0, 10.0], color::BLACK)
|
||||
.mid_top_with_margin_on(state.charwindow_rectangle, 50.0)
|
||||
.set(state.charwindow_exp_rectangle, ui);
|
||||
|
||||
// Exp-Bar Progress
|
||||
Rectangle::fill_with([170.0 * (exp_percentage), 6.0], XP_COLOR) // 0.8 = Experience percentage
|
||||
.mid_left_with_margin_on(state.charwindow_tab1_expbar, 1.0)
|
||||
.set(state.charwindow_exp_progress_rectangle, ui);
|
||||
|
||||
// Exp-Bar Foreground Frame
|
||||
Image::new(self.imgs.progress_frame)
|
||||
.w_h(170.0, 10.0)
|
||||
.middle_of(state.charwindow_exp_rectangle)
|
||||
.set(state.charwindow_tab1_expbar, ui);
|
||||
|
||||
// Exp-Text
|
||||
Text::new(&exp_treshold)
|
||||
.mid_top_with_margin_on(state.charwindow_tab1_expbar, 10.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(15))
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.charwindow_tab1_exp, ui);
|
||||
|
||||
// Divider
|
||||
|
||||
Image::new(self.imgs.divider)
|
||||
.w_h(38.0 * 4.0, 5.0 * 4.0)
|
||||
.mid_top_with_margin_on(state.charwindow_tab1_exp, 30.0)
|
||||
.set(state.divider, ui);
|
||||
|
||||
// Stats
|
||||
Text::new(
|
||||
&self
|
||||
.localized_strings
|
||||
.get("character_window.character_stats"),
|
||||
)
|
||||
.top_left_with_margins_on(state.charwindow_rectangle, 140.0, 5.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(16))
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.charwindow_tab1_statnames, ui);
|
||||
|
||||
// TODO: Shows actual stat points.
|
||||
Text::new(&format!(
|
||||
"{}\n\n{}\n\n{}",
|
||||
self.stats.endurance, self.stats.fitness, self.stats.willpower
|
||||
))
|
||||
.top_right_with_margins_on(state.charwindow_rectangle, 140.0, 5.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(16))
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.charwindow_tab1_stats, ui);
|
||||
|
||||
None
|
||||
}
|
||||
}
|
@ -1,13 +1,11 @@
|
||||
mod bag;
|
||||
mod buttons;
|
||||
mod character_window;
|
||||
mod chat;
|
||||
mod esc_menu;
|
||||
mod img_ids;
|
||||
mod item_imgs;
|
||||
mod map;
|
||||
mod minimap;
|
||||
mod quest;
|
||||
mod settings_window;
|
||||
mod skillbar;
|
||||
mod social;
|
||||
@ -19,7 +17,6 @@ use std::time::Duration;
|
||||
|
||||
use bag::Bag;
|
||||
use buttons::Buttons;
|
||||
use character_window::CharacterWindow;
|
||||
use chat::Chat;
|
||||
use chrono::NaiveTime;
|
||||
use esc_menu::EscMenu;
|
||||
@ -27,7 +24,6 @@ use img_ids::Imgs;
|
||||
use item_imgs::ItemImgs;
|
||||
use map::Map;
|
||||
use minimap::MiniMap;
|
||||
use quest::Quest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use settings_window::{SettingsTab, SettingsWindow};
|
||||
use skillbar::Skillbar;
|
||||
@ -283,8 +279,6 @@ pub struct Show {
|
||||
bag: bool,
|
||||
social: bool,
|
||||
spell: bool,
|
||||
quest: bool,
|
||||
character_window: bool,
|
||||
esc_menu: bool,
|
||||
open_windows: Windows,
|
||||
map: bool,
|
||||
@ -309,30 +303,15 @@ impl Show {
|
||||
self.want_grab = true;
|
||||
}
|
||||
|
||||
fn character_window(&mut self, open: bool) {
|
||||
self.character_window = open;
|
||||
self.bag = false;
|
||||
self.want_grab = !open;
|
||||
}
|
||||
|
||||
fn social(&mut self, open: bool) {
|
||||
self.social = open;
|
||||
self.spell = false;
|
||||
self.quest = false;
|
||||
self.want_grab = !open;
|
||||
}
|
||||
|
||||
fn spell(&mut self, open: bool) {
|
||||
self.social = false;
|
||||
self.spell = open;
|
||||
self.quest = false;
|
||||
self.want_grab = !open;
|
||||
}
|
||||
|
||||
fn quest(&mut self, open: bool) {
|
||||
self.social = false;
|
||||
self.spell = false;
|
||||
self.quest = open;
|
||||
self.want_grab = !open;
|
||||
}
|
||||
|
||||
@ -340,8 +319,6 @@ impl Show {
|
||||
|
||||
fn toggle_mini_map(&mut self) { self.mini_map = !self.mini_map; }
|
||||
|
||||
fn toggle_char_window(&mut self) { self.character_window = !self.character_window }
|
||||
|
||||
fn settings(&mut self, open: bool) {
|
||||
self.open_windows = if open {
|
||||
Windows::Settings
|
||||
@ -351,7 +328,6 @@ impl Show {
|
||||
self.bag = false;
|
||||
self.social = false;
|
||||
self.spell = false;
|
||||
self.quest = false;
|
||||
self.want_grab = !open;
|
||||
}
|
||||
|
||||
@ -371,9 +347,7 @@ impl Show {
|
||||
|| self.esc_menu
|
||||
|| self.map
|
||||
|| self.social
|
||||
|| self.quest
|
||||
|| self.spell
|
||||
|| self.character_window
|
||||
|| match self.open_windows {
|
||||
Windows::None => false,
|
||||
_ => true,
|
||||
@ -383,9 +357,7 @@ impl Show {
|
||||
self.esc_menu = false;
|
||||
self.map = false;
|
||||
self.social = false;
|
||||
self.quest = false;
|
||||
self.spell = false;
|
||||
self.character_window = false;
|
||||
self.open_windows = Windows::None;
|
||||
self.want_grab = true;
|
||||
|
||||
@ -415,25 +387,16 @@ impl Show {
|
||||
fn toggle_social(&mut self) {
|
||||
self.social = !self.social;
|
||||
self.spell = false;
|
||||
self.quest = false;
|
||||
}
|
||||
|
||||
fn open_social_tab(&mut self, social_tab: SocialTab) {
|
||||
self.social_tab = social_tab;
|
||||
self.spell = false;
|
||||
self.quest = false;
|
||||
}
|
||||
|
||||
fn toggle_spell(&mut self) {
|
||||
self.spell = !self.spell;
|
||||
self.social = false;
|
||||
self.quest = false;
|
||||
}
|
||||
|
||||
fn toggle_quest(&mut self) {
|
||||
self.quest = !self.quest;
|
||||
self.spell = false;
|
||||
self.social = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -508,9 +471,7 @@ impl Hud {
|
||||
map: false,
|
||||
ui: true,
|
||||
social: false,
|
||||
quest: false,
|
||||
spell: false,
|
||||
character_window: false,
|
||||
mini_map: true,
|
||||
settings_tab: SettingsTab::Interface,
|
||||
social_tab: SocialTab::Online,
|
||||
@ -1860,28 +1821,6 @@ impl Hud {
|
||||
}
|
||||
}
|
||||
|
||||
// Character Window
|
||||
if self.show.character_window {
|
||||
let ecs = client.state().ecs();
|
||||
let stats = ecs.read_storage::<comp::Stats>();
|
||||
let player_stats = stats.get(client.entity()).unwrap();
|
||||
match CharacterWindow::new(
|
||||
&self.show,
|
||||
&player_stats,
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
&self.voxygen_i18n,
|
||||
)
|
||||
.set(self.ids.character_window, ui_widgets)
|
||||
{
|
||||
Some(character_window::Event::Close) => {
|
||||
self.show.character_window(false);
|
||||
self.force_ungrab = true;
|
||||
},
|
||||
None => {},
|
||||
}
|
||||
}
|
||||
|
||||
// Spellbook
|
||||
if self.show.spell {
|
||||
match Spell::new(
|
||||
@ -1900,25 +1839,6 @@ impl Hud {
|
||||
None => {},
|
||||
}
|
||||
}
|
||||
|
||||
// Quest Log
|
||||
if self.show.quest {
|
||||
match Quest::new(
|
||||
&self.show,
|
||||
client,
|
||||
&self.imgs,
|
||||
&self.fonts,
|
||||
&self.voxygen_i18n,
|
||||
)
|
||||
.set(self.ids.quest, ui_widgets)
|
||||
{
|
||||
Some(quest::Event::Close) => {
|
||||
self.show.quest(false);
|
||||
self.force_ungrab = true;
|
||||
},
|
||||
None => {},
|
||||
}
|
||||
}
|
||||
// Map
|
||||
if self.show.map {
|
||||
match Map::new(
|
||||
@ -2065,14 +1985,6 @@ impl Hud {
|
||||
self.show.toggle_bag();
|
||||
true
|
||||
},
|
||||
GameInput::QuestLog => {
|
||||
self.show.toggle_quest();
|
||||
true
|
||||
},
|
||||
GameInput::CharacterWindow => {
|
||||
self.show.toggle_char_window();
|
||||
true
|
||||
},
|
||||
GameInput::Social => {
|
||||
self.show.toggle_social();
|
||||
true
|
||||
|
@ -1,117 +0,0 @@
|
||||
use super::{img_ids::Imgs, Show, TEXT_COLOR};
|
||||
use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts};
|
||||
use client::{self, Client};
|
||||
use conrod_core::{
|
||||
color,
|
||||
widget::{self, Button, Image, Rectangle, Text},
|
||||
widget_ids, Colorable, Positionable, Sizeable, Widget, WidgetCommon,
|
||||
};
|
||||
|
||||
widget_ids! {
|
||||
pub struct Ids {
|
||||
quest_frame,
|
||||
quest_close,
|
||||
quest_title,
|
||||
frame,
|
||||
content_align,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(WidgetCommon)]
|
||||
pub struct Quest<'a> {
|
||||
_show: &'a Show,
|
||||
_client: &'a Client,
|
||||
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
#[conrod(common_builder)]
|
||||
common: widget::CommonBuilder,
|
||||
}
|
||||
|
||||
impl<'a> Quest<'a> {
|
||||
pub fn new(
|
||||
show: &'a Show,
|
||||
_client: &'a Client,
|
||||
imgs: &'a Imgs,
|
||||
fonts: &'a ConrodVoxygenFonts,
|
||||
localized_strings: &'a std::sync::Arc<VoxygenLocalization>,
|
||||
) -> Self {
|
||||
Self {
|
||||
_show: show,
|
||||
imgs,
|
||||
_client,
|
||||
fonts,
|
||||
localized_strings,
|
||||
common: widget::CommonBuilder::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*pub struct State {
|
||||
ids: Ids,
|
||||
}*/
|
||||
|
||||
pub enum Event {
|
||||
Close,
|
||||
}
|
||||
|
||||
impl<'a> Widget for Quest<'a> {
|
||||
type Event = Option<Event>;
|
||||
type State = Ids;
|
||||
type Style = ();
|
||||
|
||||
fn init_state(&self, id_gen: widget::id::Generator) -> Self::State { Ids::new(id_gen) }
|
||||
|
||||
fn style(&self) -> Self::Style { () }
|
||||
|
||||
fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
|
||||
let widget::UpdateArgs {
|
||||
id: _, state, ui, ..
|
||||
} = args;
|
||||
|
||||
if self._show.character_window {
|
||||
Image::new(self.imgs.window_3)
|
||||
.top_left_with_margins_on(ui.window, 200.0, 658.0)
|
||||
.w_h(103.0 * 4.0, 122.0 * 4.0)
|
||||
.set(state.quest_frame, ui);
|
||||
} else {
|
||||
Image::new(self.imgs.window_3)
|
||||
.top_left_with_margins_on(ui.window, 200.0, 25.0)
|
||||
.w_h(103.0 * 4.0, 122.0 * 4.0)
|
||||
.set(state.quest_frame, ui);
|
||||
}
|
||||
|
||||
// X-Button
|
||||
if Button::image(self.imgs.close_button)
|
||||
.w_h(28.0, 28.0)
|
||||
.hover_image(self.imgs.close_button_hover)
|
||||
.press_image(self.imgs.close_button_press)
|
||||
.top_right_with_margins_on(state.quest_frame, 0.0, 0.0)
|
||||
.set(state.quest_close, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
return Some(Event::Close);
|
||||
}
|
||||
|
||||
// Title
|
||||
// TODO: Use an actual character name.
|
||||
Text::new(&self.localized_strings.get("hud.quests"))
|
||||
.mid_top_with_margin_on(state.quest_frame, 6.0)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.quest_title, ui);
|
||||
|
||||
// Content Alignment
|
||||
Rectangle::fill_with([95.0 * 4.0, 108.0 * 4.0], color::TRANSPARENT)
|
||||
.mid_top_with_margin_on(state.quest_frame, 40.0)
|
||||
.set(state.content_align, ui);
|
||||
|
||||
// Contents
|
||||
|
||||
// Frame
|
||||
|
||||
None
|
||||
}
|
||||
}
|
@ -88,17 +88,10 @@ impl<'a> Widget for Social<'a> {
|
||||
|
||||
let mut events = Vec::new();
|
||||
|
||||
if self.show.character_window {
|
||||
Image::new(self.imgs.window_3)
|
||||
.top_left_with_margins_on(ui.window, 200.0, 658.0)
|
||||
.w_h(103.0 * 4.0, 122.0 * 4.0)
|
||||
.set(ids.social_frame, ui);
|
||||
} else {
|
||||
Image::new(self.imgs.window_3)
|
||||
.top_left_with_margins_on(ui.window, 200.0, 25.0)
|
||||
.w_h(103.0 * 4.0, 122.0 * 4.0)
|
||||
.set(ids.social_frame, ui);
|
||||
}
|
||||
Image::new(self.imgs.window_3)
|
||||
.top_left_with_margins_on(ui.window, 200.0, 25.0)
|
||||
.w_h(103.0 * 4.0, 122.0 * 4.0)
|
||||
.set(ids.social_frame, ui);
|
||||
|
||||
// X-Button
|
||||
if Button::image(self.imgs.close_button)
|
||||
|
@ -74,17 +74,10 @@ impl<'a> Widget for Spell<'a> {
|
||||
id: _, state, ui, ..
|
||||
} = args;
|
||||
|
||||
if self._show.character_window {
|
||||
Image::new(self.imgs.window_3)
|
||||
.top_left_with_margins_on(ui.window, 200.0, 658.0)
|
||||
.w_h(103.0 * 4.0, 122.0 * 4.0)
|
||||
.set(state.spell_frame, ui);
|
||||
} else {
|
||||
Image::new(self.imgs.window_3)
|
||||
.top_left_with_margins_on(ui.window, 200.0, 25.0)
|
||||
.w_h(103.0 * 4.0, 122.0 * 4.0)
|
||||
.set(state.spell_frame, ui);
|
||||
}
|
||||
Image::new(self.imgs.window_3)
|
||||
.top_left_with_margins_on(ui.window, 200.0, 25.0)
|
||||
.w_h(103.0 * 4.0, 122.0 * 4.0)
|
||||
.set(state.spell_frame, ui);
|
||||
|
||||
// X-Button
|
||||
if Button::image(self.imgs.close_button)
|
||||
|
Loading…
Reference in New Issue
Block a user