2019-03-22 06:29:09 +00:00
|
|
|
|
use crate::{
|
|
|
|
|
render::Renderer,
|
|
|
|
|
ui::{self, ScaleMode, Ui},
|
|
|
|
|
window::Window,
|
|
|
|
|
};
|
2019-03-17 17:52:54 +00:00
|
|
|
|
use conrod_core::{
|
2019-03-22 06:29:09 +00:00
|
|
|
|
color,
|
2019-03-28 17:25:00 +00:00
|
|
|
|
color::TRANSPARENT,
|
2019-03-17 17:52:54 +00:00
|
|
|
|
image::Id as ImgId,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
text::font::Id as FontId,
|
2019-04-04 14:45:57 +00:00
|
|
|
|
widget::{text_box::Event as TextBoxEvent, Button, Image, Rectangle, Text, TextBox},
|
2019-03-22 06:29:09 +00:00
|
|
|
|
widget_ids, Borderable, Color, Colorable, Labelable, Positionable, Sizeable, Widget,
|
2019-03-17 17:52:54 +00:00
|
|
|
|
};
|
|
|
|
|
|
2019-03-22 06:29:09 +00:00
|
|
|
|
widget_ids! {
|
|
|
|
|
struct Ids {
|
|
|
|
|
// Background and logo
|
|
|
|
|
bg_selection,
|
|
|
|
|
bg_creation,
|
|
|
|
|
v_logo,
|
|
|
|
|
alpha_version,
|
|
|
|
|
|
|
|
|
|
// Windows
|
|
|
|
|
selection_window,
|
|
|
|
|
creation_window,
|
2019-03-23 02:22:05 +00:00
|
|
|
|
select_window_title,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
race_heading,
|
|
|
|
|
race_description,
|
|
|
|
|
weapon_heading,
|
|
|
|
|
weapon_description,
|
|
|
|
|
races_bg,
|
|
|
|
|
gender_bg,
|
|
|
|
|
desc_bg,
|
2019-03-28 02:25:08 +00:00
|
|
|
|
skin_eyes_window,
|
|
|
|
|
hair_window,
|
|
|
|
|
accessories_window,
|
|
|
|
|
skin_eyes_button,
|
|
|
|
|
hair_button,
|
|
|
|
|
accessories_button,
|
|
|
|
|
skin_rect,
|
|
|
|
|
eyes_rect,
|
|
|
|
|
human_skin_bg,
|
|
|
|
|
orc_skin_bg,
|
|
|
|
|
dwarf_skin_bg,
|
|
|
|
|
undead_skin_bg,
|
|
|
|
|
elf_skin_bg,
|
|
|
|
|
danari_skin_bg,
|
|
|
|
|
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
// Buttons
|
|
|
|
|
enter_world_button,
|
|
|
|
|
back_button,
|
|
|
|
|
logout_button,
|
|
|
|
|
create_character_button,
|
|
|
|
|
delete_button,
|
|
|
|
|
create_button,
|
2019-03-28 02:25:08 +00:00
|
|
|
|
name_input,
|
2019-03-23 02:22:05 +00:00
|
|
|
|
name_field,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
race_1,
|
|
|
|
|
race_2,
|
|
|
|
|
race_3,
|
|
|
|
|
race_4,
|
|
|
|
|
race_5,
|
|
|
|
|
race_6,
|
|
|
|
|
sex_1,
|
|
|
|
|
sex_2,
|
2019-03-23 02:22:05 +00:00
|
|
|
|
weapon_1,
|
|
|
|
|
weapon_2,
|
|
|
|
|
weapon_3,
|
|
|
|
|
weapon_4,
|
|
|
|
|
weapon_5,
|
|
|
|
|
weapon_6,
|
|
|
|
|
weapon_7,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
//test_chars
|
|
|
|
|
test_char_l_button,
|
|
|
|
|
test_char_l_big,
|
|
|
|
|
//test_char_m_button,
|
|
|
|
|
//test_char_r_button,
|
|
|
|
|
|
|
|
|
|
// Char Creation
|
|
|
|
|
// Race Icons
|
|
|
|
|
male,
|
|
|
|
|
female,
|
|
|
|
|
human,
|
|
|
|
|
orc,
|
|
|
|
|
dwarf,
|
|
|
|
|
undead,
|
|
|
|
|
elf,
|
|
|
|
|
danari,
|
|
|
|
|
// Weapon Icons
|
2019-03-23 02:22:05 +00:00
|
|
|
|
weapon_bg,
|
|
|
|
|
daggers,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
sword_shield,
|
|
|
|
|
sword,
|
|
|
|
|
axe,
|
|
|
|
|
hammer,
|
|
|
|
|
bow,
|
2019-03-23 02:22:05 +00:00
|
|
|
|
staff,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// Arrows
|
|
|
|
|
arrow_left,
|
|
|
|
|
arrow_right,
|
2019-03-28 02:25:08 +00:00
|
|
|
|
// Body Features
|
|
|
|
|
window_skin_eyes,
|
|
|
|
|
window_skin_eyes_mid,
|
|
|
|
|
window_skin_eyes_bot,
|
|
|
|
|
window_hair,
|
|
|
|
|
window_hair_mid,
|
|
|
|
|
window_hair_bot,
|
|
|
|
|
window_acessories,
|
|
|
|
|
window_acessories_mid,
|
|
|
|
|
window_acessories_bot,
|
|
|
|
|
skin_color_picker,
|
|
|
|
|
skin_color_slider,
|
|
|
|
|
skin_color_text,
|
|
|
|
|
skin_color_slider_text,
|
|
|
|
|
eye_color_picker,
|
|
|
|
|
eye_color_slider,
|
|
|
|
|
eye_color_text,
|
|
|
|
|
eye_color_slider_text,
|
|
|
|
|
skin_color_slider_range,
|
|
|
|
|
skin_color_slider_indicator,
|
|
|
|
|
eye_color_slider_range,
|
|
|
|
|
eye_color_slider_indicator,
|
2019-03-28 17:25:00 +00:00
|
|
|
|
hair_color_slider_text,
|
|
|
|
|
// Creation Hair Contents
|
|
|
|
|
hair_style_text,
|
|
|
|
|
hair_style_arrow_l,
|
|
|
|
|
hair_style_arrow_r,
|
|
|
|
|
hair_color_picker_bg,
|
|
|
|
|
hair_color_text,
|
|
|
|
|
hair_color_slider_range,
|
|
|
|
|
hair_color_slider_indicator,
|
|
|
|
|
eyebrow_style_text,
|
|
|
|
|
eyebrow_arrow_l,
|
|
|
|
|
eyebrow_arrow_r,
|
|
|
|
|
beard_style_text,
|
|
|
|
|
beard_arrow_l,
|
|
|
|
|
beard_arrow_r,
|
|
|
|
|
// Creation Accessories Contents
|
|
|
|
|
warpaint_text,
|
|
|
|
|
warpaint_arrow_l,
|
|
|
|
|
warpaint_arrow_r,
|
|
|
|
|
warpaint_color_picker_bg,
|
|
|
|
|
warpaint_color_text,
|
|
|
|
|
warpaint_slider_indicator,
|
|
|
|
|
warpaint_slider_range,
|
|
|
|
|
warpaint_slider_text,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Imgs {
|
|
|
|
|
v_logo: ImgId,
|
|
|
|
|
bg_selection: ImgId,
|
|
|
|
|
bg_creation: ImgId,
|
|
|
|
|
button_dark: ImgId,
|
|
|
|
|
button_dark_hover: ImgId,
|
|
|
|
|
button_dark_press: ImgId,
|
|
|
|
|
button_dark_red: ImgId,
|
|
|
|
|
button_dark_red_hover: ImgId,
|
|
|
|
|
button_dark_red_press: ImgId,
|
|
|
|
|
selection_window: ImgId,
|
|
|
|
|
test_char_l_button: ImgId,
|
|
|
|
|
test_char_l_big: ImgId,
|
2019-03-28 02:25:08 +00:00
|
|
|
|
name_input: ImgId,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
creation_window: ImgId,
|
2019-03-28 02:25:08 +00:00
|
|
|
|
creation_window_body: ImgId,
|
|
|
|
|
frame_closed: ImgId,
|
|
|
|
|
frame_closed_mo: ImgId,
|
|
|
|
|
frame_closed_press: ImgId,
|
|
|
|
|
frame_open: ImgId,
|
|
|
|
|
frame_open_mo: ImgId,
|
|
|
|
|
frame_open_press: ImgId,
|
|
|
|
|
skin_eyes_window: ImgId,
|
|
|
|
|
hair_window: ImgId,
|
|
|
|
|
accessories_window: ImgId,
|
|
|
|
|
color_picker_bg: ImgId,
|
|
|
|
|
slider_range: ImgId,
|
|
|
|
|
slider_indicator: ImgId,
|
|
|
|
|
|
2019-03-22 06:29:09 +00:00
|
|
|
|
//test_char_m_button: ImgId,
|
|
|
|
|
//test_char_r_button: ImgId,
|
|
|
|
|
// Race Icons
|
|
|
|
|
male: ImgId,
|
|
|
|
|
female: ImgId,
|
|
|
|
|
human_m: ImgId,
|
|
|
|
|
human_f: ImgId,
|
|
|
|
|
orc_m: ImgId,
|
|
|
|
|
orc_f: ImgId,
|
|
|
|
|
dwarf_m: ImgId,
|
|
|
|
|
dwarf_f: ImgId,
|
|
|
|
|
undead_m: ImgId,
|
|
|
|
|
undead_f: ImgId,
|
|
|
|
|
elf_m: ImgId,
|
|
|
|
|
elf_f: ImgId,
|
|
|
|
|
danari_m: ImgId,
|
|
|
|
|
danari_f: ImgId,
|
|
|
|
|
// Weapon Icons
|
2019-03-23 02:22:05 +00:00
|
|
|
|
daggers: ImgId,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
sword_shield: ImgId,
|
|
|
|
|
sword: ImgId,
|
|
|
|
|
axe: ImgId,
|
|
|
|
|
hammer: ImgId,
|
|
|
|
|
bow: ImgId,
|
2019-03-23 02:22:05 +00:00
|
|
|
|
staff: ImgId,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// Arrows
|
|
|
|
|
arrow_left: ImgId,
|
|
|
|
|
arrow_left_mo: ImgId,
|
|
|
|
|
arrow_left_press: ImgId,
|
|
|
|
|
arrow_left_grey: ImgId,
|
|
|
|
|
arrow_right: ImgId,
|
|
|
|
|
arrow_right_mo: ImgId,
|
|
|
|
|
arrow_right_press: ImgId,
|
|
|
|
|
arrow_right_grey: ImgId,
|
|
|
|
|
// Icon Borders
|
|
|
|
|
icon_border: ImgId,
|
|
|
|
|
icon_border_mo: ImgId,
|
|
|
|
|
icon_border_press: ImgId,
|
|
|
|
|
icon_border_pressed: ImgId,
|
|
|
|
|
}
|
|
|
|
|
impl Imgs {
|
|
|
|
|
fn new(ui: &mut Ui, renderer: &mut Renderer) -> Imgs {
|
|
|
|
|
let mut load = |filename| {
|
|
|
|
|
let image = image::open(
|
2019-04-04 14:45:57 +00:00
|
|
|
|
&[
|
|
|
|
|
env!("CARGO_MANIFEST_DIR"),
|
|
|
|
|
"/../assets/voxygen/",
|
|
|
|
|
filename,
|
|
|
|
|
]
|
|
|
|
|
.concat(),
|
2019-03-22 06:29:09 +00:00
|
|
|
|
)
|
|
|
|
|
.unwrap();
|
|
|
|
|
ui.new_image(renderer, &image).unwrap()
|
|
|
|
|
};
|
|
|
|
|
Imgs {
|
2019-03-29 21:36:15 +00:00
|
|
|
|
v_logo: load("element/v_logo.png"),
|
|
|
|
|
bg_selection: load("background/bg_selection.png"),
|
|
|
|
|
bg_creation: load("background/bg_creation.png"),
|
|
|
|
|
selection_window: load("element/frames/selection.png"),
|
|
|
|
|
button_dark: load("element/buttons/button_dark.png"),
|
|
|
|
|
button_dark_hover: load("element/buttons/button_dark_hover.png"),
|
|
|
|
|
button_dark_press: load("element/buttons/button_dark_press.png"),
|
|
|
|
|
button_dark_red: load("element/buttons/button_dark_red.png"),
|
|
|
|
|
button_dark_red_hover: load("element/buttons/button_dark_red_hover.png"),
|
|
|
|
|
button_dark_red_press: load("element/buttons/button_dark_red_press.png"),
|
|
|
|
|
test_char_l_button: load("element/misc_backgrounds/test_char_l.png"),
|
|
|
|
|
test_char_l_big: load("element/misc_backgrounds/test_char_l_big.png"),
|
|
|
|
|
name_input: load("element/misc_backgrounds/textbox.png"),
|
|
|
|
|
creation_window: load("element/frames/char_creation.png"),
|
|
|
|
|
creation_window_body: load("element/frames/body_creation.png"),
|
|
|
|
|
frame_closed: load("element/buttons/frame/closed.png"),
|
|
|
|
|
frame_closed_mo: load("element/buttons/frame/closed_mo.png"),
|
|
|
|
|
frame_closed_press: load("element/buttons/frame/closed_press.png"),
|
|
|
|
|
frame_open: load("element/buttons/frame/open.png"),
|
|
|
|
|
frame_open_mo: load("element/buttons/frame/open_mo.png"),
|
|
|
|
|
frame_open_press: load("element/buttons/frame/open_press.png"),
|
|
|
|
|
skin_eyes_window: load("element/frames/skin_eyes.png"),
|
|
|
|
|
hair_window: load("element/frames/skin_eyes.png"),
|
|
|
|
|
accessories_window: load("element/frames/skin_eyes.png"),
|
|
|
|
|
color_picker_bg: load("element/misc_backgrounds/color_picker_blank.png"),
|
|
|
|
|
slider_range: load("element/slider/track.png"),
|
|
|
|
|
slider_indicator: load("element/slider/indicator.png"),
|
2019-03-28 02:25:08 +00:00
|
|
|
|
|
2019-03-23 02:22:05 +00:00
|
|
|
|
// Weapon Icons
|
2019-03-29 21:36:15 +00:00
|
|
|
|
daggers: load("element/icons/daggers.png"),
|
|
|
|
|
sword_shield: load("element/icons/swordshield.png"),
|
|
|
|
|
sword: load("element/icons/sword.png"),
|
|
|
|
|
axe: load("element/icons/axe.png"),
|
|
|
|
|
hammer: load("element/icons/hammer.png"),
|
|
|
|
|
bow: load("element/icons/bow.png"),
|
|
|
|
|
staff: load("element/icons/staff.png"),
|
2019-03-22 06:29:09 +00:00
|
|
|
|
//test_char_m_button: load("test_char_m_button"),
|
|
|
|
|
//test_char_r_button: load("test_char_r_button"),
|
|
|
|
|
// Race Icons
|
2019-03-29 21:36:15 +00:00
|
|
|
|
male: load("element/icons/male.png"),
|
|
|
|
|
female: load("element/icons/female.png"),
|
|
|
|
|
human_m: load("element/icons/human_m.png"),
|
|
|
|
|
human_f: load("element/icons/human_f.png"),
|
|
|
|
|
orc_m: load("element/icons/orc_m.png"),
|
|
|
|
|
orc_f: load("element/icons/orc_f.png"),
|
|
|
|
|
dwarf_m: load("element/icons/dwarf_m.png"),
|
|
|
|
|
dwarf_f: load("element/icons/dwarf_f.png"),
|
|
|
|
|
undead_m: load("element/icons/ud_m.png"),
|
|
|
|
|
undead_f: load("element/icons/ud_f.png"),
|
|
|
|
|
elf_m: load("element/icons/elf_m.png"),
|
|
|
|
|
elf_f: load("element/icons/elf_f.png"),
|
|
|
|
|
danari_m: load("element/icons/danari_m.png"),
|
|
|
|
|
danari_f: load("element/icons/danari_f.png"),
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// Arrows
|
2019-03-29 21:36:15 +00:00
|
|
|
|
arrow_left: load("element/buttons/arrow/left.png"),
|
|
|
|
|
arrow_left_mo: load("element/buttons/arrow/left_mo.png"),
|
|
|
|
|
arrow_left_press: load("element/buttons/arrow/left_press.png"),
|
|
|
|
|
arrow_left_grey: load("element/buttons/arrow/left_inactive.png"),
|
|
|
|
|
arrow_right: load("element/buttons/arrow/right.png"),
|
|
|
|
|
arrow_right_mo: load("element/buttons/arrow/right_mo.png"),
|
|
|
|
|
arrow_right_press: load("element/buttons/arrow/right_press.png"),
|
|
|
|
|
arrow_right_grey: load("element/buttons/arrow/right_inactive.png"),
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// Icon Borders
|
2019-03-29 21:36:15 +00:00
|
|
|
|
icon_border: load("element/buttons/border.png"),
|
|
|
|
|
icon_border_mo: load("element/buttons/border_mo.png"),
|
|
|
|
|
icon_border_press: load("element/buttons/border_press.png"),
|
|
|
|
|
icon_border_pressed: load("element/buttons/border_pressed.png"),
|
2019-03-22 06:29:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum CreationState {
|
|
|
|
|
Race,
|
|
|
|
|
Weapon,
|
2019-03-28 02:25:08 +00:00
|
|
|
|
Body(BodyPart),
|
2019-03-22 06:29:09 +00:00
|
|
|
|
}
|
|
|
|
|
enum Races {
|
|
|
|
|
Human,
|
|
|
|
|
Orc,
|
|
|
|
|
Elf,
|
|
|
|
|
Dwarf,
|
|
|
|
|
Undead,
|
|
|
|
|
Danari,
|
|
|
|
|
}
|
2019-03-28 02:25:08 +00:00
|
|
|
|
#[derive(Clone, Copy)]
|
|
|
|
|
enum BodyPart {
|
|
|
|
|
SkinEyes,
|
|
|
|
|
Hair,
|
|
|
|
|
Accessories,
|
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
enum Sex {
|
|
|
|
|
Male,
|
|
|
|
|
Female,
|
|
|
|
|
Undefined,
|
|
|
|
|
}
|
|
|
|
|
enum Weapons {
|
|
|
|
|
Daggers,
|
|
|
|
|
SwordShield,
|
|
|
|
|
Sword,
|
|
|
|
|
Axe,
|
|
|
|
|
Hammer,
|
|
|
|
|
Bow,
|
|
|
|
|
Staff,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub enum Event {
|
|
|
|
|
Logout,
|
|
|
|
|
Play,
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-17 17:52:54 +00:00
|
|
|
|
pub struct CharSelectionUi {
|
|
|
|
|
ui: Ui,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
ids: Ids,
|
|
|
|
|
imgs: Imgs,
|
|
|
|
|
font_metamorph: FontId,
|
2019-03-28 02:25:08 +00:00
|
|
|
|
font_opensans: FontId,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
character_creation: bool,
|
|
|
|
|
selected_char_no: Option<i32>,
|
|
|
|
|
race: Races,
|
|
|
|
|
sex: Sex,
|
|
|
|
|
weapon: Weapons,
|
|
|
|
|
creation_state: CreationState,
|
2019-03-23 02:22:05 +00:00
|
|
|
|
character_name: String,
|
2019-03-17 17:52:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl CharSelectionUi {
|
|
|
|
|
pub fn new(window: &mut Window) -> Self {
|
|
|
|
|
let mut ui = Ui::new(window).unwrap();
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// TODO: adjust/remove this, right now it is used to demonstrate window scaling functionality
|
|
|
|
|
ui.scaling_mode(ScaleMode::RelativeToWindow([1920.0, 1080.0].into()));
|
|
|
|
|
// Generate ids
|
|
|
|
|
let ids = Ids::new(ui.id_generator());
|
|
|
|
|
// Load images
|
|
|
|
|
let imgs = Imgs::new(&mut ui, window.renderer_mut());
|
|
|
|
|
// Load fonts
|
2019-03-28 02:25:08 +00:00
|
|
|
|
let font_opensans = ui.new_font(
|
2019-03-22 06:29:09 +00:00
|
|
|
|
conrod_core::text::font::from_file(concat!(
|
|
|
|
|
env!("CARGO_MANIFEST_DIR"),
|
2019-03-29 21:36:15 +00:00
|
|
|
|
"/../assets/voxygen/font/OpenSans-Regular.ttf"
|
2019-03-22 06:29:09 +00:00
|
|
|
|
))
|
|
|
|
|
.unwrap(),
|
|
|
|
|
);
|
|
|
|
|
let font_metamorph = ui.new_font(
|
|
|
|
|
conrod_core::text::font::from_file(concat!(
|
|
|
|
|
env!("CARGO_MANIFEST_DIR"),
|
2019-03-29 21:36:15 +00:00
|
|
|
|
"/../assets/voxygen/font/Metamorphous-Regular.ttf"
|
2019-03-22 06:29:09 +00:00
|
|
|
|
))
|
|
|
|
|
.unwrap(),
|
|
|
|
|
);
|
2019-03-17 17:52:54 +00:00
|
|
|
|
Self {
|
|
|
|
|
ui,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
imgs,
|
|
|
|
|
ids,
|
|
|
|
|
font_metamorph,
|
2019-03-28 02:25:08 +00:00
|
|
|
|
font_opensans,
|
2019-03-22 06:29:09 +00:00
|
|
|
|
character_creation: false,
|
|
|
|
|
selected_char_no: None,
|
2019-03-23 02:22:05 +00:00
|
|
|
|
character_name: "Character Name".to_string(),
|
2019-03-22 06:29:09 +00:00
|
|
|
|
race: Races::Human,
|
|
|
|
|
sex: Sex::Male,
|
|
|
|
|
weapon: Weapons::Sword,
|
|
|
|
|
creation_state: CreationState::Race,
|
2019-03-17 17:52:54 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-28 02:25:08 +00:00
|
|
|
|
// TODO: split this up into multiple modules or functions
|
2019-03-22 06:29:09 +00:00
|
|
|
|
fn update_layout(&mut self) -> Vec<Event> {
|
|
|
|
|
let mut events = Vec::new();
|
|
|
|
|
let ref mut ui_widgets = self.ui.set_widgets();
|
|
|
|
|
|
|
|
|
|
// Character Selection /////////////////
|
|
|
|
|
// Supposed functionality:
|
|
|
|
|
// 3d rendered characters have to be clicked for selection
|
|
|
|
|
// Selected characters will appear in the selection window
|
|
|
|
|
// the selection window is only active when there are >0 characters on the server
|
|
|
|
|
// after logging into the server the character that was played last will be selected automatically
|
|
|
|
|
// if >1 characters are on the server but none of them was logged in last the one that was created last will be selected
|
|
|
|
|
// if the no. of characters = character_limit the "Create Character" button won't be clickable anymore
|
|
|
|
|
|
|
|
|
|
// Background Image
|
|
|
|
|
if !self.character_creation {
|
|
|
|
|
Image::new(self.imgs.bg_selection)
|
|
|
|
|
.middle_of(ui_widgets.window)
|
|
|
|
|
.set(self.ids.bg_selection, ui_widgets);
|
|
|
|
|
|
|
|
|
|
// Logout_Button
|
|
|
|
|
if Button::image(self.imgs.button_dark)
|
|
|
|
|
.bottom_left_with_margins_on(self.ids.bg_selection, 10.0, 10.0)
|
|
|
|
|
.w_h(150.0, 40.0)
|
|
|
|
|
.hover_image(self.imgs.button_dark_hover)
|
|
|
|
|
.press_image(self.imgs.button_dark_press)
|
|
|
|
|
.label("Logout")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(18)
|
|
|
|
|
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
|
|
|
|
.set(self.ids.logout_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
events.push(Event::Logout);
|
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
2019-03-28 02:25:08 +00:00
|
|
|
|
// Create Character Button
|
2019-03-22 06:29:09 +00:00
|
|
|
|
if Button::image(self.imgs.button_dark)
|
|
|
|
|
.mid_bottom_with_margin_on(self.ids.bg_selection, 10.0)
|
|
|
|
|
.w_h(270.0, 50.0)
|
|
|
|
|
.hover_image(self.imgs.button_dark_hover)
|
|
|
|
|
.press_image(self.imgs.button_dark_press)
|
|
|
|
|
.label("Create Character")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(20)
|
|
|
|
|
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
|
|
|
|
.set(self.ids.create_character_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.character_creation = true;
|
|
|
|
|
self.selected_char_no = None;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
|
|
|
|
// Test Characters
|
2019-03-22 06:29:09 +00:00
|
|
|
|
if Button::image(self.imgs.test_char_l_button)
|
2019-03-23 02:22:05 +00:00
|
|
|
|
.bottom_left_with_margins_on(self.ids.bg_selection, 395.0, 716.0)
|
2019-03-22 06:29:09 +00:00
|
|
|
|
.w_h(95.0, 130.0)
|
|
|
|
|
.hover_image(self.imgs.test_char_l_button)
|
|
|
|
|
.press_image(self.imgs.test_char_l_button)
|
|
|
|
|
.set(self.ids.test_char_l_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-04-05 22:36:04 +00:00
|
|
|
|
self.selected_char_no = Some(1);
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
// Veloren Logo and Alpha Version
|
|
|
|
|
Button::image(self.imgs.v_logo)
|
|
|
|
|
.w_h(346.0, 111.0)
|
|
|
|
|
.top_left_with_margins_on(self.ids.bg_selection, 30.0, 40.0)
|
|
|
|
|
.label("Alpha 0.1")
|
|
|
|
|
.label_rgba(255.0, 255.0, 255.0, 1.0)
|
|
|
|
|
.label_font_size(10)
|
|
|
|
|
.label_y(conrod_core::position::Relative::Scalar(-40.0))
|
|
|
|
|
.label_x(conrod_core::position::Relative::Scalar(-100.0))
|
|
|
|
|
.set(self.ids.v_logo, ui_widgets);
|
|
|
|
|
|
2019-04-05 22:36:04 +00:00
|
|
|
|
if let Some(no) = self.selected_char_no {
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// Selection_Window
|
|
|
|
|
Image::new(self.imgs.selection_window)
|
|
|
|
|
.w_h(522.0, 722.0)
|
|
|
|
|
.mid_right_with_margin_on(ui_widgets.window, 10.0)
|
|
|
|
|
.set(self.ids.selection_window, ui_widgets);
|
|
|
|
|
|
|
|
|
|
// Selected Character
|
|
|
|
|
if no == 1 {
|
|
|
|
|
Image::new(self.imgs.test_char_l_big)
|
|
|
|
|
.middle_of(self.ids.selection_window)
|
|
|
|
|
.set(self.ids.test_char_l_big, ui_widgets);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Enter World Button
|
|
|
|
|
if Button::image(self.imgs.button_dark)
|
|
|
|
|
.mid_bottom_with_margin_on(self.ids.selection_window, 65.0)
|
|
|
|
|
.w_h(210.0, 55.0)
|
|
|
|
|
.hover_image(self.imgs.button_dark_hover)
|
|
|
|
|
.press_image(self.imgs.button_dark_press)
|
|
|
|
|
.label("Enter World")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(22)
|
|
|
|
|
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
|
|
|
|
.set(self.ids.enter_world_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
// Enter World
|
|
|
|
|
events.push(Event::Play);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Delete Button
|
|
|
|
|
if Button::image(self.imgs.button_dark_red)
|
|
|
|
|
.bottom_right_with_margins_on(self.ids.selection_window, -25.0, 0.0)
|
|
|
|
|
.w_h(100.0, 20.0)
|
|
|
|
|
.hover_image(self.imgs.button_dark_red_hover)
|
|
|
|
|
.press_image(self.imgs.button_dark_red_press)
|
|
|
|
|
.label("Delete")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(12)
|
|
|
|
|
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
|
|
|
|
.set(self.ids.delete_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Character_Creation //////////////
|
|
|
|
|
else {
|
|
|
|
|
// Background
|
|
|
|
|
Image::new(self.imgs.bg_creation)
|
|
|
|
|
.middle_of(ui_widgets.window)
|
|
|
|
|
.set(self.ids.bg_creation, ui_widgets);
|
|
|
|
|
// Back Button
|
|
|
|
|
if Button::image(self.imgs.button_dark)
|
|
|
|
|
.bottom_left_with_margins_on(self.ids.bg_creation, 10.0, 10.0)
|
|
|
|
|
.w_h(150.0, 40.0)
|
|
|
|
|
.hover_image(self.imgs.button_dark_hover)
|
|
|
|
|
.press_image(self.imgs.button_dark_press)
|
|
|
|
|
.label("Back")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(18)
|
|
|
|
|
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
|
|
|
|
.set(self.ids.back_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.character_creation = false;
|
|
|
|
|
}
|
|
|
|
|
// Create Button
|
|
|
|
|
if Button::image(self.imgs.button_dark)
|
|
|
|
|
.bottom_right_with_margins_on(self.ids.bg_creation, 10.0, 10.0)
|
|
|
|
|
.w_h(150.0, 40.0)
|
|
|
|
|
.hover_image(self.imgs.button_dark_hover)
|
|
|
|
|
.press_image(self.imgs.button_dark_press)
|
|
|
|
|
.label("Create")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(18)
|
|
|
|
|
.label_y(conrod_core::position::Relative::Scalar(3.0))
|
|
|
|
|
.set(self.ids.create_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.character_creation = false;
|
|
|
|
|
}
|
|
|
|
|
// Character Name Input
|
2019-03-28 02:25:08 +00:00
|
|
|
|
Button::image(self.imgs.name_input)
|
2019-03-23 02:22:05 +00:00
|
|
|
|
.w_h(337.0, 67.0)
|
|
|
|
|
.mid_bottom_with_margin_on(self.ids.bg_creation, 10.0)
|
2019-03-28 02:25:08 +00:00
|
|
|
|
.set(self.ids.name_input, ui_widgets);
|
2019-03-23 02:22:05 +00:00
|
|
|
|
for event in TextBox::new(&self.character_name)
|
2019-03-28 02:25:08 +00:00
|
|
|
|
.w_h(300.0, 60.0)
|
2019-03-28 17:25:00 +00:00
|
|
|
|
.mid_top_with_margin_on(self.ids.name_input, 2.0)
|
|
|
|
|
.font_size(26)
|
2019-03-23 02:22:05 +00:00
|
|
|
|
.font_id(self.font_metamorph)
|
|
|
|
|
.center_justify()
|
2019-03-28 17:25:00 +00:00
|
|
|
|
.text_color(Color::Rgba(220.0, 220.0, 220.0, 0.8))
|
|
|
|
|
.color(TRANSPARENT)
|
|
|
|
|
.border_color(TRANSPARENT)
|
2019-03-28 02:25:08 +00:00
|
|
|
|
.set(self.ids.name_field, ui_widgets)
|
|
|
|
|
{
|
|
|
|
|
match event {
|
|
|
|
|
TextBoxEvent::Update(name) => {
|
|
|
|
|
self.character_name = name;
|
2019-03-23 02:22:05 +00:00
|
|
|
|
}
|
2019-03-28 02:25:08 +00:00
|
|
|
|
TextBoxEvent::Enter => {}
|
2019-03-23 02:22:05 +00:00
|
|
|
|
}
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
// Window(s)
|
2019-03-28 17:25:00 +00:00
|
|
|
|
Image::new(if let CreationState::Body(_) = self.creation_state {
|
|
|
|
|
self.imgs.creation_window_body
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.creation_window
|
|
|
|
|
})
|
|
|
|
|
.w_h(628.0, 814.0)
|
|
|
|
|
.top_left_with_margins_on(self.ids.bg_creation, 60.0, 30.0)
|
|
|
|
|
.set(self.ids.creation_window, ui_widgets);
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
// Arrows
|
2019-03-23 02:22:05 +00:00
|
|
|
|
// TODO: lower the resolution of the arrow images & use non decimal sizes below
|
|
|
|
|
const ARROW_WH: [f64; 2] = [986.0 * 0.03, 1024.0 * 0.03];
|
2019-03-22 06:29:09 +00:00
|
|
|
|
match self.creation_state {
|
|
|
|
|
CreationState::Race => {
|
|
|
|
|
Button::image(self.imgs.arrow_left_grey)
|
|
|
|
|
.wh(ARROW_WH)
|
|
|
|
|
.top_left_with_margins_on(self.ids.creation_window, 74.0, 55.0)
|
|
|
|
|
.set(self.ids.arrow_left, ui_widgets);
|
|
|
|
|
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.wh(ARROW_WH)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.top_right_with_margins_on(self.ids.creation_window, 74.0, 55.0)
|
|
|
|
|
.set(self.ids.arrow_right, ui_widgets)
|
2019-03-23 02:22:05 +00:00
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Weapon;
|
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
}
|
|
|
|
|
CreationState::Weapon => {
|
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.wh(ARROW_WH)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.top_left_with_margins_on(self.ids.creation_window, 74.0, 55.0)
|
|
|
|
|
.set(self.ids.arrow_left, ui_widgets)
|
2019-03-23 02:22:05 +00:00
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Race;
|
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.wh(ARROW_WH)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.top_right_with_margins_on(self.ids.creation_window, 74.0, 55.0)
|
|
|
|
|
.set(self.ids.arrow_right, ui_widgets)
|
2019-03-23 02:22:05 +00:00
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Body(BodyPart::SkinEyes);
|
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
}
|
2019-03-28 02:25:08 +00:00
|
|
|
|
CreationState::Body(_) => {
|
2019-03-22 06:29:09 +00:00
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.wh(ARROW_WH)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.top_left_with_margins_on(self.ids.creation_window, 74.0, 55.0)
|
|
|
|
|
.set(self.ids.arrow_left, ui_widgets)
|
2019-03-23 02:22:05 +00:00
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Weapon;
|
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
Button::image(self.imgs.arrow_right_grey)
|
|
|
|
|
.wh(ARROW_WH)
|
|
|
|
|
.top_right_with_margins_on(self.ids.creation_window, 74.0, 55.0)
|
|
|
|
|
.set(self.ids.arrow_right, ui_widgets);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Races
|
|
|
|
|
|
|
|
|
|
// Weapon
|
|
|
|
|
|
|
|
|
|
// Body
|
|
|
|
|
|
|
|
|
|
//Race Selection
|
|
|
|
|
if let CreationState::Race = self.creation_state {
|
|
|
|
|
Text::new("Choose your Race")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.creation_window, 74.0)
|
|
|
|
|
.font_size(28)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
2019-03-23 02:22:05 +00:00
|
|
|
|
.set(self.ids.select_window_title, ui_widgets);
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
// Male/Female/Race Icons
|
|
|
|
|
// for alignment
|
|
|
|
|
Rectangle::fill_with([151.0, 68.0], color::TRANSPARENT)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.creation_window, 210.0)
|
|
|
|
|
.set(self.ids.gender_bg, ui_widgets);
|
|
|
|
|
|
|
|
|
|
// Male
|
|
|
|
|
Image::new(self.imgs.male)
|
|
|
|
|
.w_h(68.0, 68.0)
|
|
|
|
|
.mid_left_of(self.ids.gender_bg)
|
|
|
|
|
.set(self.ids.male, ui_widgets);
|
2019-03-23 02:22:05 +00:00
|
|
|
|
if Button::image(if let Sex::Male = self.sex {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.male)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.sex_1, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.sex = Sex::Male;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// Female
|
|
|
|
|
Image::new(self.imgs.female)
|
|
|
|
|
.w_h(68.0, 68.0)
|
2019-03-28 02:25:08 +00:00
|
|
|
|
.right_from(self.ids.male, 16.0)
|
2019-03-22 06:29:09 +00:00
|
|
|
|
.set(self.ids.female, ui_widgets);
|
2019-03-23 02:22:05 +00:00
|
|
|
|
if Button::image(if let Sex::Female = self.sex {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.female)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.sex_2, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.sex = Sex::Female;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// for alignment
|
|
|
|
|
Rectangle::fill_with([458.0, 68.0], color::TRANSPARENT)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.creation_window, 120.0)
|
|
|
|
|
.set(self.ids.races_bg, ui_widgets);
|
|
|
|
|
// TODO: If races where in some sort of array format we could do this in a loop
|
|
|
|
|
// Human
|
2019-03-23 02:22:05 +00:00
|
|
|
|
Image::new(if let Sex::Male = self.sex {
|
|
|
|
|
self.imgs.human_m
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.human_f
|
|
|
|
|
})
|
|
|
|
|
.w_h(68.0, 68.0)
|
|
|
|
|
.mid_left_of(self.ids.races_bg)
|
|
|
|
|
.set(self.ids.human, ui_widgets);
|
|
|
|
|
if Button::image(if let Races::Human = self.race {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.human)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.race_1, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.race = Races::Human;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
// Orc
|
2019-03-23 02:22:05 +00:00
|
|
|
|
Image::new(if let Sex::Male = self.sex {
|
|
|
|
|
self.imgs.orc_m
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.orc_f
|
|
|
|
|
})
|
|
|
|
|
.w_h(68.0, 68.0)
|
|
|
|
|
.right_from(self.ids.human, 10.0)
|
|
|
|
|
.set(self.ids.orc, ui_widgets);
|
|
|
|
|
if Button::image(if let Races::Orc = self.race {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.orc)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.race_2, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.race = Races::Orc;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// Dwarf
|
2019-03-23 02:22:05 +00:00
|
|
|
|
Image::new(if let Sex::Male = self.sex {
|
|
|
|
|
self.imgs.dwarf_m
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.dwarf_f
|
|
|
|
|
})
|
|
|
|
|
.w_h(68.0, 68.0)
|
|
|
|
|
.right_from(self.ids.human, 10.0 * 2.0 + 68.0)
|
|
|
|
|
.set(self.ids.dwarf, ui_widgets);
|
|
|
|
|
if Button::image(if let Races::Dwarf = self.race {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.dwarf)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.race_3, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.race = Races::Dwarf;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// Elf
|
2019-03-23 02:22:05 +00:00
|
|
|
|
Image::new(if let Sex::Male = self.sex {
|
|
|
|
|
self.imgs.elf_m
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.elf_f
|
|
|
|
|
})
|
|
|
|
|
.w_h(68.0, 68.0)
|
|
|
|
|
.right_from(self.ids.human, 10.0 * 3.0 + 68.0 * 2.0)
|
|
|
|
|
.set(self.ids.elf, ui_widgets);
|
|
|
|
|
if Button::image(if let Races::Elf = self.race {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.elf)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.race_4, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.race = Races::Elf;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// Undead
|
2019-03-23 02:22:05 +00:00
|
|
|
|
Image::new(if let Sex::Male = self.sex {
|
|
|
|
|
self.imgs.undead_m
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.undead_f
|
|
|
|
|
})
|
|
|
|
|
.w_h(68.0, 68.0)
|
|
|
|
|
.right_from(self.ids.human, 10.0 * 4.0 + 68.0 * 3.0)
|
|
|
|
|
.set(self.ids.undead, ui_widgets);
|
|
|
|
|
if Button::image(if let Races::Undead = self.race {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.undead)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.race_5, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.race = Races::Undead;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
// Danari
|
2019-03-23 02:22:05 +00:00
|
|
|
|
Image::new(if let Sex::Male = self.sex {
|
|
|
|
|
self.imgs.danari_m
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.danari_f
|
|
|
|
|
})
|
|
|
|
|
.right_from(self.ids.human, 10.0 * 5.0 + 68.0 * 4.0)
|
|
|
|
|
.set(self.ids.danari, ui_widgets);
|
|
|
|
|
if Button::image(if let Races::Danari = self.race {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.w_h(68.0, 68.0)
|
|
|
|
|
.middle_of(self.ids.danari)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.race_6, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.race = Races::Danari;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
// Description Headline and Text
|
|
|
|
|
|
|
|
|
|
// TODO: Load these from files (or from the server???)
|
2019-03-28 19:16:06 +00:00
|
|
|
|
const HUMAN_DESC: &str =
|
|
|
|
|
"The former nomads were only recently able to gain a foothold in the world of Veloren. \n\
|
|
|
|
|
\n\
|
2019-04-04 14:45:57 +00:00
|
|
|
|
Their greatest strengths are their adaptability and intelligence, which makes them allrounders in many fields.";
|
2019-03-28 17:25:00 +00:00
|
|
|
|
const ORC_DESC: &str =
|
2019-03-28 19:16:06 +00:00
|
|
|
|
"They are considered brutal, rude and combative. \n\
|
2019-04-04 14:45:57 +00:00
|
|
|
|
But once you gained their trust they will be loyal friends \n\
|
|
|
|
|
that follow a strict code of honor in all of their actions. \n\
|
|
|
|
|
\n\
|
|
|
|
|
Their warriors are masters of melee combat, but their true power \
|
|
|
|
|
comes from the magical rituals of their powerful shamans.";
|
2019-03-28 17:25:00 +00:00
|
|
|
|
const DWARF_DESC: &str =
|
|
|
|
|
"Smoking chimneys, the sound of countless hammers and hoes. \
|
2019-03-28 19:16:06 +00:00
|
|
|
|
Infinite tunnel systems to track down even the last chunk of metal in the ground. \n\
|
|
|
|
|
\n\
|
|
|
|
|
This race of master craftsmen and grim fighters exist almost \
|
|
|
|
|
as long as the world itself.\n\
|
|
|
|
|
And they don't plan to finish their reign over the undergrounds soon.";
|
|
|
|
|
const UNDEAD_DESC: &str =
|
|
|
|
|
"No one really knows the origin of these gruesome looking creatures. \n\
|
|
|
|
|
Some may have been reawakened soldiers from a battleground others are said to be the result of experiments with dark magic.\n\
|
|
|
|
|
\n\
|
|
|
|
|
After being chased and slaughtered for years the more civilised Undead decided to form a community and negotiate a piece treaty with the other inhabitants of Veloren.\n\
|
|
|
|
|
\n\
|
|
|
|
|
They are known for being nefarious and silent assassins.";
|
2019-03-28 17:25:00 +00:00
|
|
|
|
const ELF_DESC: &str =
|
|
|
|
|
"No matter which shade of elves you encounter, they all have something in common: Magic. \n\
|
|
|
|
|
They can be found in many Forms: \n\
|
|
|
|
|
\n\
|
2019-03-28 19:16:06 +00:00
|
|
|
|
Pale Elves, living in dark fortresses, executing atrocious rituals. \n\
|
2019-03-28 17:25:00 +00:00
|
|
|
|
\n\
|
|
|
|
|
Nature connected Brushwood Elves, that guard ancient powers inside the forests.\n\
|
|
|
|
|
\n\
|
|
|
|
|
Gold Elves that hunger for political power in their massive city states. \n\
|
|
|
|
|
\n\
|
|
|
|
|
And many more!";
|
2019-03-28 19:16:06 +00:00
|
|
|
|
const DANARI_DESC: &str =
|
|
|
|
|
"The white domes and towers of their underwater kingdom are often mistaken for coral reefs from above the water. \n\
|
|
|
|
|
As a punishment those demonic creatures were banished to live detached from the rest of the world in ancient times. \n\
|
|
|
|
|
\n\
|
|
|
|
|
Once in a while one of them is born unaffected by this curse. Sadly this means that after reaching a certain age they won’t be able to live underwater anymore. \n\
|
|
|
|
|
\n\
|
|
|
|
|
Outcast communities consisting of these Blessed Danari have formed all over the land.";
|
2019-03-23 02:22:05 +00:00
|
|
|
|
|
|
|
|
|
let (race_str, race_desc) = match self.race {
|
|
|
|
|
Races::Human => ("Humans", HUMAN_DESC),
|
|
|
|
|
Races::Orc => ("Orcs", ORC_DESC),
|
|
|
|
|
Races::Dwarf => ("Dwarves", DWARF_DESC),
|
|
|
|
|
Races::Undead => ("Undead", UNDEAD_DESC),
|
|
|
|
|
Races::Elf => ("Elves", ELF_DESC),
|
|
|
|
|
Races::Danari => ("Danari", DANARI_DESC),
|
|
|
|
|
};
|
2019-03-22 06:29:09 +00:00
|
|
|
|
Text::new(race_str)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.creation_window, 370.0)
|
|
|
|
|
.font_size(30)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.race_heading, ui_widgets);
|
|
|
|
|
Text::new(race_desc)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.creation_window, 410.0)
|
|
|
|
|
.w(500.0)
|
|
|
|
|
.font_size(20)
|
2019-03-28 02:25:08 +00:00
|
|
|
|
.font_id(self.font_opensans)
|
2019-03-22 06:29:09 +00:00
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.wrap_by_word()
|
|
|
|
|
.set(self.ids.race_description, ui_widgets);
|
|
|
|
|
// Races Descriptions
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-23 02:22:05 +00:00
|
|
|
|
if let CreationState::Weapon = self.creation_state {
|
|
|
|
|
Text::new("Choose your Weapon")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.creation_window, 74.0)
|
|
|
|
|
.font_size(28)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.select_window_title, ui_widgets);
|
|
|
|
|
// BG for Alignment
|
|
|
|
|
Rectangle::fill_with([470.0, 60.0], color::TRANSPARENT)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.creation_window, 180.0)
|
|
|
|
|
.set(self.ids.weapon_bg, ui_widgets);
|
|
|
|
|
// Weapons Icons
|
|
|
|
|
// Sword and Shield
|
|
|
|
|
Image::new(self.imgs.sword_shield)
|
|
|
|
|
.w_h(60.0, 60.0)
|
|
|
|
|
.mid_left_of(self.ids.weapon_bg)
|
|
|
|
|
.set(self.ids.sword_shield, ui_widgets);
|
|
|
|
|
if Button::image(if let Weapons::SwordShield = self.weapon {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.sword_shield)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.weapon_1, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.weapon = Weapons::SwordShield;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-23 02:22:05 +00:00
|
|
|
|
|
|
|
|
|
// Daggers
|
|
|
|
|
Image::new(self.imgs.daggers)
|
|
|
|
|
.w_h(60.0, 60.0)
|
|
|
|
|
.right_from(self.ids.sword_shield, 8.0)
|
|
|
|
|
.set(self.ids.daggers, ui_widgets);
|
|
|
|
|
if Button::image(if let Weapons::Daggers = self.weapon {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.daggers)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.weapon_2, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.weapon = Weapons::Daggers;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-23 02:22:05 +00:00
|
|
|
|
|
|
|
|
|
// Sword
|
|
|
|
|
Image::new(self.imgs.sword)
|
|
|
|
|
.w_h(60.0, 60.0)
|
|
|
|
|
.right_from(self.ids.sword_shield, 8.0 * 2.0 + 60.0 * 1.0)
|
|
|
|
|
.set(self.ids.sword, ui_widgets);
|
|
|
|
|
if Button::image(if let Weapons::Sword = self.weapon {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.sword)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.weapon_3, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.weapon = Weapons::Sword;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-23 02:22:05 +00:00
|
|
|
|
// Axe
|
|
|
|
|
Image::new(self.imgs.axe)
|
|
|
|
|
.w_h(60.0, 60.0)
|
|
|
|
|
.right_from(self.ids.sword_shield, 8.0 * 3.0 + 60.0 * 2.0)
|
|
|
|
|
.set(self.ids.axe, ui_widgets);
|
|
|
|
|
if Button::image(if let Weapons::Axe = self.weapon {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.axe)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.weapon_4, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.weapon = Weapons::Axe;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-23 02:22:05 +00:00
|
|
|
|
// Hammer
|
|
|
|
|
Image::new(self.imgs.hammer)
|
|
|
|
|
.w_h(60.0, 60.0)
|
|
|
|
|
.right_from(self.ids.sword_shield, 8.0 * 4.0 + 60.0 * 3.0)
|
|
|
|
|
.set(self.ids.hammer, ui_widgets);
|
|
|
|
|
if Button::image(if let Weapons::Hammer = self.weapon {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.hammer)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.weapon_5, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.weapon = Weapons::Hammer;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-23 02:22:05 +00:00
|
|
|
|
// Bow
|
|
|
|
|
Image::new(self.imgs.bow)
|
|
|
|
|
.w_h(60.0, 60.0)
|
|
|
|
|
.right_from(self.ids.sword_shield, 8.0 * 5.0 + 60.0 * 4.0)
|
|
|
|
|
.set(self.ids.bow, ui_widgets);
|
|
|
|
|
if Button::image(if let Weapons::Bow = self.weapon {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.bow)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.weapon_6, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.weapon = Weapons::Bow;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-23 02:22:05 +00:00
|
|
|
|
// Staff
|
|
|
|
|
Image::new(self.imgs.staff)
|
|
|
|
|
.w_h(60.0, 60.0)
|
|
|
|
|
.right_from(self.ids.sword_shield, 8.0 * 6.0 + 60.0 * 5.0)
|
|
|
|
|
.set(self.ids.staff, ui_widgets);
|
|
|
|
|
if Button::image(if let Weapons::Staff = self.weapon {
|
|
|
|
|
self.imgs.icon_border_pressed
|
|
|
|
|
} else {
|
|
|
|
|
self.imgs.icon_border
|
|
|
|
|
})
|
|
|
|
|
.middle_of(self.ids.staff)
|
|
|
|
|
.hover_image(self.imgs.icon_border_mo)
|
|
|
|
|
.press_image(self.imgs.icon_border_press)
|
|
|
|
|
.set(self.ids.weapon_7, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
|
|
|
|
self.weapon = Weapons::Staff;
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
2019-03-23 02:22:05 +00:00
|
|
|
|
|
|
|
|
|
// TODO: Load these from files (or from the server???)
|
|
|
|
|
const SWORDSHIELD_DESC: &str = " MISSING ";
|
|
|
|
|
const DAGGERS_DESC: &str = " MISSING ";
|
|
|
|
|
const SWORD_DESC: &str = " MISSING ";
|
|
|
|
|
const AXE_DESC: &str = " MISSING ";
|
|
|
|
|
const HAMMER_DESC: &str = " MISSING ";
|
|
|
|
|
const BOW_DESC: &str = " MISSING ";
|
|
|
|
|
const STAFF_DESC: &str = " MISSING ";
|
|
|
|
|
|
|
|
|
|
let (weapon_str, weapon_desc) = match self.weapon {
|
|
|
|
|
Weapons::SwordShield => ("Sword and Shield", SWORDSHIELD_DESC),
|
|
|
|
|
Weapons::Daggers => ("Daggers", DAGGERS_DESC),
|
|
|
|
|
Weapons::Sword => ("Sword", SWORD_DESC),
|
|
|
|
|
Weapons::Axe => ("Axe", AXE_DESC),
|
|
|
|
|
Weapons::Hammer => ("Hammer", HAMMER_DESC),
|
|
|
|
|
Weapons::Bow => ("Bow", BOW_DESC),
|
|
|
|
|
Weapons::Staff => ("Staff", STAFF_DESC),
|
|
|
|
|
};
|
|
|
|
|
Text::new(weapon_str)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.creation_window, 370.0)
|
|
|
|
|
.font_size(30)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.race_heading, ui_widgets);
|
|
|
|
|
Text::new(weapon_desc)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.creation_window, 410.0)
|
|
|
|
|
.w(500.0)
|
|
|
|
|
.font_size(20)
|
2019-03-28 02:25:08 +00:00
|
|
|
|
.font_id(self.font_opensans)
|
2019-03-23 02:22:05 +00:00
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.wrap_by_word()
|
|
|
|
|
.set(self.ids.race_description, ui_widgets);
|
|
|
|
|
// Races Descriptions
|
|
|
|
|
}
|
2019-03-28 02:25:08 +00:00
|
|
|
|
// 3 states/windows: 1.Skin & Eyes 2.Hair 3.Accessories
|
|
|
|
|
// If one state is activated the other ones collapse
|
|
|
|
|
// The title bar is the button to unfold/collapse the windows
|
|
|
|
|
// The BG Frame can be stretched to the needed size
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
2019-03-28 02:25:08 +00:00
|
|
|
|
// Window BG
|
|
|
|
|
if let CreationState::Body(state) = self.creation_state {
|
|
|
|
|
Text::new("Body Customization")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.creation_window, 74.0)
|
|
|
|
|
.font_size(28)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.select_window_title, ui_widgets);
|
|
|
|
|
|
|
|
|
|
match state {
|
|
|
|
|
// Skin Eyes Open
|
|
|
|
|
BodyPart::SkinEyes => {
|
|
|
|
|
Image::new(self.imgs.skin_eyes_window)
|
2019-03-28 17:25:00 +00:00
|
|
|
|
.w_h(511.0, 333.0)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.select_window_title, 60.0)
|
|
|
|
|
.set(self.ids.skin_eyes_window, ui_widgets);
|
|
|
|
|
// Open Window: Skin & Eyes
|
|
|
|
|
if Button::image(self.imgs.frame_open_mo)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.skin_eyes_window, 0.0)
|
|
|
|
|
.w_h(511.0, 37.0)
|
|
|
|
|
//.hover_image(self.imgs.frame_open_mo)
|
|
|
|
|
//.press_image(self.imgs.frame_open_press)
|
|
|
|
|
.label("Skin & Eyes")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_y(conrod_core::position::Relative::Scalar(4.0))
|
|
|
|
|
.label_font_size(16)
|
|
|
|
|
.set(self.ids.skin_eyes_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Body(BodyPart::SkinEyes);
|
|
|
|
|
}
|
2019-03-28 17:25:00 +00:00
|
|
|
|
// Closed: Hair
|
|
|
|
|
if Button::image(self.imgs.frame_closed)
|
|
|
|
|
.down_from(self.ids.skin_eyes_window, 5.0)
|
|
|
|
|
.w_h(511.0, 31.0)
|
|
|
|
|
.hover_image(self.imgs.frame_closed_mo)
|
|
|
|
|
.press_image(self.imgs.frame_closed_press)
|
|
|
|
|
.label("Hair")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(16)
|
|
|
|
|
.set(self.ids.hair_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Body(BodyPart::Hair);
|
|
|
|
|
}
|
2019-03-28 17:25:00 +00:00
|
|
|
|
// Closed: Accessories
|
|
|
|
|
if Button::image(self.imgs.frame_closed)
|
|
|
|
|
.down_from(self.ids.hair_button, 5.0)
|
|
|
|
|
.w_h(511.0, 31.0)
|
|
|
|
|
.hover_image(self.imgs.frame_closed_mo)
|
|
|
|
|
.press_image(self.imgs.frame_closed_press)
|
|
|
|
|
.label("Accessories")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(16)
|
|
|
|
|
.set(self.ids.accessories_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Body(BodyPart::Accessories);
|
|
|
|
|
}
|
|
|
|
|
} // State 1 fin
|
|
|
|
|
|
2019-03-28 17:25:00 +00:00
|
|
|
|
// Hair Open
|
2019-03-28 02:25:08 +00:00
|
|
|
|
BodyPart::Hair => {
|
|
|
|
|
Image::new(self.imgs.hair_window)
|
2019-03-28 17:25:00 +00:00
|
|
|
|
.w_h(511.0, 400.0) //333.0
|
|
|
|
|
.down_from(self.ids.skin_eyes_button, 5.0)
|
|
|
|
|
.set(self.ids.hair_window, ui_widgets);
|
|
|
|
|
// Closed Window: Skin & Eyes
|
|
|
|
|
if Button::image(self.imgs.frame_closed)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.select_window_title, 60.0)
|
|
|
|
|
.w_h(511.0, 31.0)
|
|
|
|
|
.hover_image(self.imgs.frame_closed_mo)
|
|
|
|
|
.press_image(self.imgs.frame_closed_press)
|
|
|
|
|
.label("Skin & Eyes")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(16)
|
|
|
|
|
.set(self.ids.skin_eyes_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Body(BodyPart::SkinEyes);
|
|
|
|
|
}
|
2019-03-28 17:25:00 +00:00
|
|
|
|
// Open Window: Hair
|
|
|
|
|
if Button::image(self.imgs.frame_open_mo)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.hair_window, 0.0)
|
|
|
|
|
.w_h(511.0, 37.0)
|
|
|
|
|
//.hover_image(self.imgs.frame_closed_mo)
|
|
|
|
|
//.press_image(self.imgs.frame_closed_press)
|
|
|
|
|
.label("Hair")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_y(conrod_core::position::Relative::Scalar(4.0))
|
|
|
|
|
.label_font_size(16)
|
|
|
|
|
.set(self.ids.hair_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Body(BodyPart::Hair);
|
|
|
|
|
}
|
2019-03-28 17:25:00 +00:00
|
|
|
|
// Closed: Accessories
|
|
|
|
|
if Button::image(self.imgs.frame_closed)
|
|
|
|
|
.down_from(self.ids.hair_window, 5.0)
|
|
|
|
|
.w_h(511.0, 31.0)
|
|
|
|
|
.hover_image(self.imgs.frame_closed_mo)
|
|
|
|
|
.press_image(self.imgs.frame_closed_press)
|
|
|
|
|
.label("Accessories")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(16)
|
|
|
|
|
.set(self.ids.accessories_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Body(BodyPart::Accessories);
|
|
|
|
|
}
|
|
|
|
|
} // State 2 fin
|
|
|
|
|
|
|
|
|
|
// Open: Accessories
|
2019-03-28 17:25:00 +00:00
|
|
|
|
BodyPart::Accessories => {
|
2019-03-28 02:25:08 +00:00
|
|
|
|
Image::new(self.imgs.hair_window)
|
2019-03-28 17:25:00 +00:00
|
|
|
|
.w_h(511.0, 333.0)
|
|
|
|
|
.down_from(self.ids.hair_button, 5.0)
|
|
|
|
|
.set(self.ids.accessories_window, ui_widgets);
|
|
|
|
|
// Closed Window: Skin & Eyes
|
|
|
|
|
if Button::image(self.imgs.frame_closed)
|
|
|
|
|
.mid_top_with_margin_on(self.ids.select_window_title, 60.0)
|
|
|
|
|
.w_h(511.0, 31.0)
|
|
|
|
|
.hover_image(self.imgs.frame_closed_mo)
|
|
|
|
|
.press_image(self.imgs.frame_closed_press)
|
|
|
|
|
.label("Skin & Eyes")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(16)
|
|
|
|
|
.set(self.ids.skin_eyes_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Body(BodyPart::SkinEyes);
|
|
|
|
|
}
|
2019-03-28 17:25:00 +00:00
|
|
|
|
// Closed: Hair
|
|
|
|
|
if Button::image(self.imgs.frame_closed)
|
|
|
|
|
.down_from(self.ids.skin_eyes_button, 5.0)
|
|
|
|
|
.w_h(511.0, 31.0)
|
|
|
|
|
.hover_image(self.imgs.frame_closed_mo)
|
|
|
|
|
.press_image(self.imgs.frame_closed_press)
|
|
|
|
|
.label("Hair")
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(16)
|
|
|
|
|
.set(self.ids.hair_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Body(BodyPart::Hair);
|
|
|
|
|
}
|
2019-03-28 17:25:00 +00:00
|
|
|
|
// Open: Accessories
|
|
|
|
|
if Button::image(self.imgs.frame_open_mo)
|
|
|
|
|
.down_from(self.ids.hair_button, 5.0)
|
|
|
|
|
.w_h(511.0, 37.0)
|
|
|
|
|
//.hover_image(self.imgs.frame_closed_mo)
|
|
|
|
|
//.press_image(self.imgs.frame_closed_press)
|
|
|
|
|
.label("Accessories")
|
|
|
|
|
.label_y(conrod_core::position::Relative::Scalar(4.0))
|
|
|
|
|
.label_rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.label_font_size(16)
|
|
|
|
|
.set(self.ids.accessories_button, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{
|
2019-03-28 02:25:08 +00:00
|
|
|
|
self.creation_state = CreationState::Body(BodyPart::Accessories);
|
|
|
|
|
}
|
|
|
|
|
} // State 3 fin
|
|
|
|
|
} // match fin
|
|
|
|
|
|
|
|
|
|
// Body Customization Window Contents ////////////////////////
|
|
|
|
|
match state {
|
|
|
|
|
BodyPart::SkinEyes => {
|
2019-03-28 17:25:00 +00:00
|
|
|
|
// Skin Color: Text, Brightness Slider, Picker
|
|
|
|
|
Text::new("Skin Color")
|
|
|
|
|
.top_left_with_margins_on(self.ids.skin_rect, 0.0, -250.0)
|
|
|
|
|
.font_size(25)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.skin_color_text, ui_widgets);
|
|
|
|
|
// TODO: Align Buttons here
|
|
|
|
|
// They set an i32 to a value from 0-14
|
|
|
|
|
// Depending on the race another color will be chosen
|
|
|
|
|
// Here only the BG image changes depending on the race.
|
|
|
|
|
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
|
|
|
|
.top_right_with_margins_on(self.ids.skin_eyes_window, 60.0, 30.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.skin_rect, ui_widgets);
|
|
|
|
|
|
|
|
|
|
// TODO:Slider
|
|
|
|
|
// Sliders actually change the Alpha-Level of the main colour chosen above
|
|
|
|
|
// -> They will appear "brighter", therefore the sliders are labeled "Brightness"
|
|
|
|
|
Image::new(self.imgs.slider_range)
|
|
|
|
|
.w_h(208.0, 12.0)
|
|
|
|
|
.bottom_left_with_margins_on(self.ids.skin_rect, 10.0, -255.0)
|
|
|
|
|
.set(self.ids.skin_color_slider_range, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_indicator)
|
|
|
|
|
.w_h(10.0, 22.0)
|
|
|
|
|
.middle_of(self.ids.skin_color_slider_range)
|
|
|
|
|
.set(self.ids.skin_color_slider_indicator, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Text::new("Brightness")
|
|
|
|
|
.top_left_with_margins_on(self.ids.skin_color_slider_range, -27.0, 0.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(14)
|
|
|
|
|
.set(self.ids.skin_color_slider_text, ui_widgets);
|
|
|
|
|
|
|
|
|
|
// Eye Color: Text, Brightness Slider, Picker
|
|
|
|
|
Text::new("Eye Color")
|
|
|
|
|
.top_left_with_margins_on(self.ids.eyes_rect, 0.0, -250.0)
|
|
|
|
|
.font_size(25)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.eye_color_text, ui_widgets);
|
|
|
|
|
// TODO: Align 16 Buttons here
|
|
|
|
|
//
|
|
|
|
|
// They set a variable to a value from 0-14
|
|
|
|
|
// Depending on the race another color will be chosen
|
|
|
|
|
// Only the BG image (190x114 -> 2px border!) changes depending on the race.
|
|
|
|
|
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
|
|
|
|
.top_right_with_margins_on(self.ids.skin_eyes_window, 186.0, 30.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.eyes_rect, ui_widgets);
|
|
|
|
|
|
|
|
|
|
// TODO:Slider
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_range)
|
|
|
|
|
.w_h(208.0, 12.0)
|
|
|
|
|
.bottom_left_with_margins_on(self.ids.eyes_rect, 10.0, -255.0)
|
|
|
|
|
.set(self.ids.eye_color_slider_range, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_indicator)
|
|
|
|
|
.w_h(10.0, 22.0)
|
|
|
|
|
.middle_of(self.ids.eye_color_slider_range)
|
|
|
|
|
.set(self.ids.eye_color_slider_indicator, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Text::new("Brightness")
|
|
|
|
|
.top_left_with_margins_on(self.ids.eye_color_slider_range, -27.0, 0.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(14)
|
|
|
|
|
.set(self.ids.eye_color_slider_text, ui_widgets);
|
2019-03-28 02:25:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Hair ///////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
// Hair Styles -> Arrows
|
|
|
|
|
// Hair Color -> Picker
|
|
|
|
|
// Eye Brow Style -> Arrow
|
|
|
|
|
// Facial Hair -> Picker (Only active for males!)
|
2019-03-28 17:25:00 +00:00
|
|
|
|
BodyPart::Hair => {
|
|
|
|
|
// Hair
|
|
|
|
|
Text::new("Hair Style")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.hair_window, 60.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(24)
|
|
|
|
|
.set(self.ids.hair_style_text, ui_widgets);
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.right_from(self.ids.hair_style_text, 15.0)
|
|
|
|
|
.set(self.ids.hair_style_arrow_r, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.left_from(self.ids.hair_style_text, 15.0)
|
|
|
|
|
.set(self.ids.hair_style_arrow_l, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
|
|
|
|
|
Text::new("Hair Color")
|
|
|
|
|
.top_left_with_margins_on(self.ids.hair_color_picker_bg, 0.0, -250.0)
|
|
|
|
|
.font_size(25)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.hair_color_text, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
|
|
|
|
.top_right_with_margins_on(self.ids.hair_window, 114.0, 30.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.hair_color_picker_bg, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_range)
|
|
|
|
|
.w_h(208.0, 12.0)
|
|
|
|
|
.bottom_left_with_margins_on(
|
|
|
|
|
self.ids.hair_color_picker_bg,
|
|
|
|
|
10.0,
|
|
|
|
|
-255.0,
|
|
|
|
|
)
|
|
|
|
|
.set(self.ids.hair_color_slider_range, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_indicator)
|
|
|
|
|
.w_h(10.0, 22.0)
|
|
|
|
|
.middle_of(self.ids.hair_color_slider_range)
|
|
|
|
|
.set(self.ids.hair_color_slider_indicator, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Text::new("Brightness")
|
|
|
|
|
.top_left_with_margins_on(self.ids.hair_color_slider_range, -27.0, 0.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(14)
|
|
|
|
|
.set(self.ids.hair_color_slider_text, ui_widgets);
|
|
|
|
|
// Eyebrows
|
|
|
|
|
Text::new("Eyebrow Style")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.hair_window, 280.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(24)
|
|
|
|
|
.set(self.ids.eyebrow_style_text, ui_widgets);
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.right_from(self.ids.eyebrow_style_text, 15.0)
|
|
|
|
|
.set(self.ids.eyebrow_arrow_r, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.left_from(self.ids.eyebrow_style_text, 15.0)
|
|
|
|
|
.set(self.ids.eyebrow_arrow_l, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
// Beard -> Only active when "male" was chosen
|
|
|
|
|
if let Sex::Male = self.sex {
|
|
|
|
|
Text::new("Beard Style")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.hair_window, 340.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(24)
|
|
|
|
|
.set(self.ids.beard_style_text, ui_widgets);
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.right_from(self.ids.beard_style_text, 15.0)
|
|
|
|
|
.set(self.ids.beard_arrow_r, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.left_from(self.ids.beard_style_text, 15.0)
|
|
|
|
|
.set(self.ids.beard_arrow_l, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-28 02:25:08 +00:00
|
|
|
|
|
|
|
|
|
// Accessories ///////////////////////////////
|
|
|
|
|
|
|
|
|
|
// Accessory Picker -> Arrows (Name Changes with race!)
|
|
|
|
|
// Color -> Picker
|
|
|
|
|
// Brightness -> Slider
|
2019-03-28 17:25:00 +00:00
|
|
|
|
BodyPart::Accessories => {
|
|
|
|
|
match self.race {
|
|
|
|
|
Races::Human => {
|
|
|
|
|
Text::new("Head Band")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(24)
|
|
|
|
|
.set(self.ids.warpaint_text, ui_widgets);
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.right_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_r, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.left_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_l, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
|
|
|
|
|
Text::new("Color")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
0.0,
|
|
|
|
|
-250.0,
|
|
|
|
|
)
|
|
|
|
|
.font_size(25)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_text, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
|
|
|
|
.top_right_with_margins_on(
|
|
|
|
|
self.ids.accessories_window,
|
|
|
|
|
114.0,
|
|
|
|
|
30.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_range)
|
|
|
|
|
.w_h(208.0, 12.0)
|
|
|
|
|
.bottom_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
10.0,
|
|
|
|
|
-255.0,
|
|
|
|
|
)
|
|
|
|
|
.set(self.ids.warpaint_slider_range, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_indicator)
|
|
|
|
|
.w_h(10.0, 22.0)
|
|
|
|
|
.middle_of(self.ids.warpaint_slider_range)
|
|
|
|
|
.set(self.ids.warpaint_slider_indicator, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Text::new("Brightness")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_slider_range,
|
|
|
|
|
-27.0,
|
|
|
|
|
0.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(14)
|
|
|
|
|
.set(self.ids.warpaint_slider_text, ui_widgets);
|
|
|
|
|
} // Human
|
|
|
|
|
Races::Orc => {
|
|
|
|
|
Text::new("Head Band")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(24)
|
|
|
|
|
.set(self.ids.warpaint_text, ui_widgets);
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.right_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_r, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.left_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_l, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
|
|
|
|
|
Text::new("Color")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
0.0,
|
|
|
|
|
-250.0,
|
|
|
|
|
)
|
|
|
|
|
.font_size(25)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_text, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
|
|
|
|
.top_right_with_margins_on(
|
|
|
|
|
self.ids.accessories_window,
|
|
|
|
|
114.0,
|
|
|
|
|
30.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_range)
|
|
|
|
|
.w_h(208.0, 12.0)
|
|
|
|
|
.bottom_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
10.0,
|
|
|
|
|
-255.0,
|
|
|
|
|
)
|
|
|
|
|
.set(self.ids.warpaint_slider_range, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_indicator)
|
|
|
|
|
.w_h(10.0, 22.0)
|
|
|
|
|
.middle_of(self.ids.warpaint_slider_range)
|
|
|
|
|
.set(self.ids.warpaint_slider_indicator, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Text::new("Brightness")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_slider_range,
|
|
|
|
|
-27.0,
|
|
|
|
|
0.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(14)
|
|
|
|
|
.set(self.ids.warpaint_slider_text, ui_widgets);
|
|
|
|
|
} // Orc
|
|
|
|
|
Races::Elf => {
|
|
|
|
|
Text::new("Tribe Markings")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(24)
|
|
|
|
|
.set(self.ids.warpaint_text, ui_widgets);
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.right_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_r, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.left_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_l, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
|
|
|
|
|
Text::new("Color")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
0.0,
|
|
|
|
|
-250.0,
|
|
|
|
|
)
|
|
|
|
|
.font_size(25)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_text, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
|
|
|
|
.top_right_with_margins_on(
|
|
|
|
|
self.ids.accessories_window,
|
|
|
|
|
114.0,
|
|
|
|
|
30.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_range)
|
|
|
|
|
.w_h(208.0, 12.0)
|
|
|
|
|
.bottom_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
10.0,
|
|
|
|
|
-255.0,
|
|
|
|
|
)
|
|
|
|
|
.set(self.ids.warpaint_slider_range, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_indicator)
|
|
|
|
|
.w_h(10.0, 22.0)
|
|
|
|
|
.middle_of(self.ids.warpaint_slider_range)
|
|
|
|
|
.set(self.ids.warpaint_slider_indicator, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Text::new("Brightness")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_slider_range,
|
|
|
|
|
-27.0,
|
|
|
|
|
0.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(14)
|
|
|
|
|
.set(self.ids.warpaint_slider_text, ui_widgets);
|
|
|
|
|
} // Elf
|
|
|
|
|
Races::Dwarf => {
|
|
|
|
|
Text::new("War Paint")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(24)
|
|
|
|
|
.set(self.ids.warpaint_text, ui_widgets);
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.right_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_r, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.left_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_l, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
|
|
|
|
|
Text::new("Color")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
0.0,
|
|
|
|
|
-250.0,
|
|
|
|
|
)
|
|
|
|
|
.font_size(25)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_text, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
|
|
|
|
.top_right_with_margins_on(
|
|
|
|
|
self.ids.accessories_window,
|
|
|
|
|
114.0,
|
|
|
|
|
30.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_range)
|
|
|
|
|
.w_h(208.0, 12.0)
|
|
|
|
|
.bottom_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
10.0,
|
|
|
|
|
-255.0,
|
|
|
|
|
)
|
|
|
|
|
.set(self.ids.warpaint_slider_range, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_indicator)
|
|
|
|
|
.w_h(10.0, 22.0)
|
|
|
|
|
.middle_of(self.ids.warpaint_slider_range)
|
|
|
|
|
.set(self.ids.warpaint_slider_indicator, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Text::new("Brightness")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_slider_range,
|
|
|
|
|
-27.0,
|
|
|
|
|
0.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(14)
|
|
|
|
|
.set(self.ids.warpaint_slider_text, ui_widgets);
|
|
|
|
|
} // Dwarf
|
|
|
|
|
Races::Undead => {
|
|
|
|
|
Text::new("Teeth")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(24)
|
|
|
|
|
.set(self.ids.warpaint_text, ui_widgets);
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.right_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_r, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.left_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_l, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
|
|
|
|
|
Text::new("Color")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
0.0,
|
|
|
|
|
-250.0,
|
|
|
|
|
)
|
|
|
|
|
.font_size(25)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_text, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
|
|
|
|
.top_right_with_margins_on(
|
|
|
|
|
self.ids.accessories_window,
|
|
|
|
|
114.0,
|
|
|
|
|
30.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_range)
|
|
|
|
|
.w_h(208.0, 12.0)
|
|
|
|
|
.bottom_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
10.0,
|
|
|
|
|
-255.0,
|
|
|
|
|
)
|
|
|
|
|
.set(self.ids.warpaint_slider_range, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_indicator)
|
|
|
|
|
.w_h(10.0, 22.0)
|
|
|
|
|
.middle_of(self.ids.warpaint_slider_range)
|
|
|
|
|
.set(self.ids.warpaint_slider_indicator, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Text::new("Brightness")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_slider_range,
|
|
|
|
|
-27.0,
|
|
|
|
|
0.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(14)
|
|
|
|
|
.set(self.ids.warpaint_slider_text, ui_widgets);
|
|
|
|
|
} // Undead
|
|
|
|
|
Races::Danari => {
|
|
|
|
|
Text::new("Horns")
|
|
|
|
|
.mid_top_with_margin_on(self.ids.accessories_window, 60.0)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(24)
|
|
|
|
|
.set(self.ids.warpaint_text, ui_widgets);
|
|
|
|
|
if Button::image(self.imgs.arrow_right)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_right_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_right_press)
|
|
|
|
|
.right_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_r, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
if Button::image(self.imgs.arrow_left)
|
|
|
|
|
.w_h(986.0 * 0.02, 1024.0 * 0.02)
|
|
|
|
|
.hover_image(self.imgs.arrow_left_mo)
|
|
|
|
|
.press_image(self.imgs.arrow_left_press)
|
|
|
|
|
.left_from(self.ids.warpaint_text, 15.0)
|
|
|
|
|
.set(self.ids.warpaint_arrow_l, ui_widgets)
|
|
|
|
|
.was_clicked()
|
|
|
|
|
{};
|
|
|
|
|
|
|
|
|
|
Text::new("Color")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
0.0,
|
|
|
|
|
-250.0,
|
|
|
|
|
)
|
|
|
|
|
.font_size(25)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_text, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Rectangle::fill_with([192.0, 116.0], color::WHITE)
|
|
|
|
|
.top_right_with_margins_on(
|
|
|
|
|
self.ids.accessories_window,
|
|
|
|
|
114.0,
|
|
|
|
|
30.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.set(self.ids.warpaint_color_picker_bg, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_range)
|
|
|
|
|
.w_h(208.0, 12.0)
|
|
|
|
|
.bottom_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_color_picker_bg,
|
|
|
|
|
10.0,
|
|
|
|
|
-255.0,
|
|
|
|
|
)
|
|
|
|
|
.set(self.ids.warpaint_slider_range, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Image::new(self.imgs.slider_indicator)
|
|
|
|
|
.w_h(10.0, 22.0)
|
|
|
|
|
.middle_of(self.ids.warpaint_slider_range)
|
|
|
|
|
.set(self.ids.warpaint_slider_indicator, ui_widgets);
|
|
|
|
|
|
|
|
|
|
Text::new("Brightness")
|
|
|
|
|
.top_left_with_margins_on(
|
|
|
|
|
self.ids.warpaint_slider_range,
|
|
|
|
|
-27.0,
|
|
|
|
|
0.0,
|
|
|
|
|
)
|
|
|
|
|
.rgba(220.0, 220.0, 220.0, 0.8)
|
|
|
|
|
.font_size(14)
|
|
|
|
|
.set(self.ids.warpaint_slider_text, ui_widgets);
|
|
|
|
|
} // Danari
|
|
|
|
|
} // match Race fin
|
|
|
|
|
} // Accessories fin
|
|
|
|
|
} // Body Customization Fin
|
2019-03-28 02:25:08 +00:00
|
|
|
|
} // CreationState::Body Fin
|
|
|
|
|
} // Char Creation fin
|
2019-03-22 06:29:09 +00:00
|
|
|
|
|
|
|
|
|
events
|
2019-03-17 17:52:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-22 03:55:42 +00:00
|
|
|
|
pub fn handle_event(&mut self, event: ui::Event) {
|
|
|
|
|
self.ui.handle_event(event);
|
2019-03-17 17:52:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-22 06:29:09 +00:00
|
|
|
|
pub fn maintain(&mut self, renderer: &mut Renderer) -> Vec<Event> {
|
|
|
|
|
let events = self.update_layout();
|
2019-03-17 17:52:54 +00:00
|
|
|
|
self.ui.maintain(renderer);
|
2019-03-22 06:29:09 +00:00
|
|
|
|
events
|
2019-03-17 17:52:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn render(&self, renderer: &mut Renderer) {
|
|
|
|
|
self.ui.render(renderer);
|
|
|
|
|
}
|
|
|
|
|
}
|