diff --git a/assets/voxygen/element/map/dif_0.png b/assets/voxygen/element/map/dif_0.png new file mode 100644 index 0000000000..292954f5e1 --- /dev/null +++ b/assets/voxygen/element/map/dif_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7edcd2cd1dcdbf64a89bd00dd353ceb461330db4bfa3d26343ac8d4ce991801 +size 1798 diff --git a/assets/voxygen/element/map/dif_1.png b/assets/voxygen/element/map/dif_1.png new file mode 100644 index 0000000000..13480e7a4d --- /dev/null +++ b/assets/voxygen/element/map/dif_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee9de87421d694fb4950bdd584ba0234be444af5c7b25ac8d1b7f4af785cfdf1 +size 1803 diff --git a/assets/voxygen/element/map/dif_2.png b/assets/voxygen/element/map/dif_2.png new file mode 100644 index 0000000000..8e0ca35ed0 --- /dev/null +++ b/assets/voxygen/element/map/dif_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87936f3cf93567e8913bf7263d73c6fc71a728014bf59663dd35e952cb30d980 +size 1804 diff --git a/assets/voxygen/element/map/dif_3.png b/assets/voxygen/element/map/dif_3.png new file mode 100644 index 0000000000..8c6f98e063 --- /dev/null +++ b/assets/voxygen/element/map/dif_3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18fb560e7235cd028b3bf3be38b4ee987920b678abfdda862328d7bb16516e8f +size 1804 diff --git a/assets/voxygen/element/map/dif_4.png b/assets/voxygen/element/map/dif_4.png new file mode 100644 index 0000000000..1727907a86 --- /dev/null +++ b/assets/voxygen/element/map/dif_4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53f7b6c30cfe0ad22633b6dcdeba72eecf9fb228e59d8fb62b011447df48c7de +size 1805 diff --git a/assets/voxygen/element/map/dif_5.png b/assets/voxygen/element/map/dif_5.png new file mode 100644 index 0000000000..9a08746b0e --- /dev/null +++ b/assets/voxygen/element/map/dif_5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e87c2c6e3fd597cfc21acc4ac4b3d38e396b3466a949635c25fa8ece0907c6a +size 2060 diff --git a/assets/voxygen/element/misc_bg/map_bg.png b/assets/voxygen/element/misc_bg/map_bg.png index fba5549934..7ea4ec2de6 100644 --- a/assets/voxygen/element/misc_bg/map_bg.png +++ b/assets/voxygen/element/misc_bg/map_bg.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f1c93ac6021ddd3509fb7b0303cb3e1936a6486bcf3c9de322ee44e0e029339 -size 5070 +oid sha256:29bf1dc5a534e139e3f95f2ac1b85d66ba24515e73b2c14aab90948676e32ac7 +size 5895 diff --git a/assets/voxygen/element/misc_bg/map_frame.png b/assets/voxygen/element/misc_bg/map_frame.png index 9ca8ec9a4c..77fa89104a 100644 --- a/assets/voxygen/element/misc_bg/map_frame.png +++ b/assets/voxygen/element/misc_bg/map_frame.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c60fdaef39e24811ea35c7aff0c7752dd5a1ee69b958426219baf5c24bda4478 -size 2427 +oid sha256:82186b65cc831c5e1222adcb5508bfb70f383d639efa56f216430d8c12431879 +size 4231 diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index fbe2012f0f..60d857bb25 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -193,6 +193,12 @@ image_ids! { mmap_minus: "voxygen.element.buttons.min_plus.mmap_button-min", mmap_minus_hover: "voxygen.element.buttons.min_plus.mmap_button-min_hover", mmap_minus_press: "voxygen.element.buttons.min_plus.mmap_button-min_press", + map_dif_0: "voxygen.element.map.dif_0", + map_dif_1: "voxygen.element.map.dif_1", + map_dif_2: "voxygen.element.map.dif_2", + map_dif_3: "voxygen.element.map.dif_3", + map_dif_4: "voxygen.element.map.dif_4", + map_dif_5: "voxygen.element.map.dif_5", mmap_site_town: "voxygen.element.map.town", mmap_site_town_hover: "voxygen.element.map.town_hover", mmap_site_dungeon: "voxygen.element.map.dungeon", diff --git a/voxygen/src/hud/map.rs b/voxygen/src/hud/map.rs index 65099598d0..b6a84ffac6 100644 --- a/voxygen/src/hud/map.rs +++ b/voxygen/src/hud/map.rs @@ -1,6 +1,6 @@ use super::{ img_ids::{Imgs, ImgsRot}, - Show, TEXT_COLOR, UI_GOLD, UI_HIGHLIGHT_0, UI_MAIN, + Show, TEXT_COLOR, UI_HIGHLIGHT_0, UI_MAIN, QUALITY_LOW, QUALITY_COMMON, QUALITY_MODERATE, QUALITY_HIGH, QUALITY_EPIC, QUALITY_DEBUG, }; use crate::{ i18n::Localization, @@ -17,6 +17,8 @@ use conrod_core::{ use specs::WorldExt; use vek::*; +use inline_tweak::*; + widget_ids! { struct Ids { frame, @@ -33,12 +35,26 @@ widget_ids! { qlog_title, zoom_slider, mmap_site_icons[], + site_difs[], + map_settings_align, + show_towns_img, + show_towns_box, + show_towns_text, + show_castles_img, + show_castles_box, + show_castles_text, + show_dungeons_img, + show_dungeons_box, + show_dungeons_text, + show_difficulty_img, + show_difficulty_box, + show_difficulty_text, } } #[derive(WidgetCommon)] pub struct Map<'a> { - _show: &'a Show, + show: &'a Show, client: &'a Client, world_map: &'a (img_ids::Rotations, Vec2), imgs: &'a Imgs, @@ -66,7 +82,7 @@ impl<'a> Map<'a> { tooltip_manager: &'a mut TooltipManager, ) -> Self { Self { - _show: show, + show: show, imgs, rot_imgs, world_map, @@ -87,6 +103,10 @@ pub struct State { pub enum Event { MapZoom(f64), + ShowDifficulties, + ShowTowns, + ShowCastles, + ShowDungeons, Close, } @@ -129,20 +149,20 @@ impl<'a> Widget for Map<'a> { .desc_text_color(TEXT_COLOR); // Frame Image::new(self.imgs.map_bg) - .w_h(1052.0, 886.0) + .w_h(1202.0, 886.0) .mid_top_with_margin_on(ui.window, 5.0) .color(Some(UI_MAIN)) .set(state.ids.bg, ui); Image::new(self.imgs.map_frame) - .w_h(1052.0, 886.0) + .w_h(1202.0, 886.0) .middle_of(state.ids.bg) .color(Some(UI_HIGHLIGHT_0)) .set(state.ids.frame, ui); // Map Content Alignment Rectangle::fill_with([814.0, 834.0], color::TRANSPARENT) - .top_right_with_margins_on(state.ids.frame, 46.0, 2.0) + .top_left_with_margins_on(state.ids.frame, 46.0, tweak!(240.0)) .set(state.ids.map_align, ui); // Questlog Content Alignment @@ -255,7 +275,113 @@ impl<'a> Widget for Map<'a> { { events.push(Event::MapZoom(new_val as f64)); } + // Icon settings + // Alignment + Rectangle::fill_with([tweak!(150.0), tweak!(200.0)], color::TRANSPARENT) + .top_right_with_margins_on(state.ids.frame, tweak!(55.0), tweak!(10.0)) + .set(state.ids.map_settings_align, ui); + // Checkboxes + // Show difficulties + Image::new(self.imgs.map_dif_5) + .top_left_with_margins_on(state.ids.map_settings_align, 5.0, 5.0) + .w_h(20.0, 20.0) + .set(state.ids.show_difficulty_img, ui); + if Button::image(if self.show.map_difficulty { + self.imgs.checkbox_checked} else {self.imgs.checkbox}) + .w_h(18.0, 18.0) + .hover_image(if self.show.map_difficulty { + self.imgs.checkbox_checked_mo} else {self.imgs.checkbox_mo}) + .press_image(if self.show.map_difficulty { + self.imgs.checkbox_checked} else {self.imgs.checkbox_press}) + .right_from(state.ids.show_difficulty_img, 10.0) + .set(state.ids.show_difficulty_box, ui) + .was_clicked() + { + events.push(Event::ShowDifficulties); + } + Text::new("Difficulty") + .right_from(state.ids.show_difficulty_box, 10.0) + .font_size(self.fonts.cyri.scale(14)) + .font_id(self.fonts.cyri.conrod_id) + .graphics_for(state.ids.show_difficulty_box) + .color(TEXT_COLOR) + .set(state.ids.show_difficulty_text, ui); + // Towns + Image::new(self.imgs.mmap_site_town) + .down_from(state.ids.show_difficulty_img, 10.0) + .w_h(20.0, 20.0) + .set(state.ids.show_towns_img, ui); + if Button::image(if self.show.map_towns { + self.imgs.checkbox_checked} else {self.imgs.checkbox}) + .w_h(18.0, 18.0) + .hover_image(if self.show.map_towns { + self.imgs.checkbox_checked_mo} else {self.imgs.checkbox_mo}) + .press_image(if self.show.map_towns { + self.imgs.checkbox_checked} else {self.imgs.checkbox_press}) + .right_from(state.ids.show_towns_img, 10.0) + .set(state.ids.show_towns_box, ui) + .was_clicked() + { + events.push(Event::ShowTowns); + } + Text::new("Towns") + .right_from(state.ids.show_towns_box, 10.0) + .font_size(self.fonts.cyri.scale(14)) + .font_id(self.fonts.cyri.conrod_id) + .graphics_for(state.ids.show_towns_box) + .color(TEXT_COLOR) + .set(state.ids.show_towns_text, ui); + // Castles + Image::new(self.imgs.mmap_site_castle) + .down_from(state.ids.show_towns_img, 10.0) + .w_h(20.0, 20.0) + .set(state.ids.show_castles_img, ui); + if Button::image(if self.show.map_castles { + self.imgs.checkbox_checked} else {self.imgs.checkbox}) + .w_h(18.0, 18.0) + .hover_image(if self.show.map_castles { + self.imgs.checkbox_checked_mo} else {self.imgs.checkbox_mo}) + .press_image(if self.show.map_castles { + self.imgs.checkbox_checked} else {self.imgs.checkbox_press}) + .right_from(state.ids.show_castles_img, 10.0) + .set(state.ids.show_castles_box, ui) + .was_clicked() + { + events.push(Event::ShowCastles); + } + Text::new("Castles") + .right_from(state.ids.show_castles_box, 10.0) + .font_size(self.fonts.cyri.scale(14)) + .font_id(self.fonts.cyri.conrod_id) + .graphics_for(state.ids.show_castles_box) + .color(TEXT_COLOR) + .set(state.ids.show_castles_text, ui); + // Dungeons + Image::new(self.imgs.mmap_site_dungeon) +.down_from(state.ids.show_castles_img, 10.0) +.w_h(20.0, 20.0) +.set(state.ids.show_dungeons_img, ui); +if Button::image(if self.show.map_dungeons { + self.imgs.checkbox_checked} else {self.imgs.checkbox}) +.w_h(18.0, 18.0) +.hover_image(if self.show.map_dungeons { + self.imgs.checkbox_checked_mo} else {self.imgs.checkbox_mo}) +.press_image(if self.show.map_dungeons { + self.imgs.checkbox_checked} else {self.imgs.checkbox_press}) + .right_from(state.ids.show_dungeons_img, 10.0) +.set(state.ids.show_dungeons_box, ui) +.was_clicked() +{ + events.push(Event::ShowDungeons); +} +Text::new("Dungeons") + .right_from(state.ids.show_dungeons_box, 10.0) + .font_size(self.fonts.cyri.scale(14)) + .font_id(self.fonts.cyri.conrod_id) + .graphics_for(state.ids.show_dungeons_box) + .color(TEXT_COLOR) + .set(state.ids.show_dungeons_text, ui); // Map icons if state.ids.mmap_site_icons.len() < self.client.sites().len() { state.update(|state| { @@ -265,6 +391,14 @@ impl<'a> Widget for Map<'a> { .resize(self.client.sites().len(), &mut ui.widget_id_generator()) }); } + if state.ids.site_difs.len() < self.client.sites().len() { + state.update(|state| { + state + .ids + .site_difs + .resize(self.client.sites().len(), &mut ui.widget_id_generator()) + }); + } for (i, site) in self.client.sites().iter().enumerate() { let rwpos = site.wpos.map(|e| e as f32) - player_pos; let rcpos = @@ -279,16 +413,17 @@ impl<'a> Widget for Map<'a> { { continue; } + let dif = (i as f64 / 100.0 * 6.0) as u8; let title = match &site.kind { SiteKind::Town => "Town", SiteKind::Dungeon => "Dungeon", SiteKind::Castle => "Castle", }; - let desc = ""; + let desc = format!("Difficulty: {}", dif); Button::image(match &site.kind { - SiteKind::Town => self.imgs.mmap_site_town, - SiteKind::Dungeon => self.imgs.mmap_site_dungeon, - SiteKind::Castle => self.imgs.mmap_site_castle, + SiteKind::Town => if self.show.map_towns {self.imgs.mmap_site_town } else {self.imgs.nothing}, + SiteKind::Dungeon => if self.show.map_dungeons {self.imgs.mmap_site_dungeon} else {self.imgs.nothing}, + SiteKind::Castle => if self.show.map_castles {self.imgs.mmap_site_castle} else {self.imgs.nothing}, }) .x_y_position_relative_to( state.ids.grid, @@ -303,8 +438,62 @@ impl<'a> Widget for Map<'a> { }) .image_color(UI_HIGHLIGHT_0) .parent(ui.window) - .with_tooltip(self.tooltip_manager, title, desc, &site_tooltip, TEXT_COLOR) + .with_tooltip(self.tooltip_manager, title, &desc, &site_tooltip, match dif { + 1 => QUALITY_LOW, + 2 => QUALITY_COMMON, + 3 => QUALITY_MODERATE, + 4 => QUALITY_HIGH, + 5 => QUALITY_EPIC, + 6 => QUALITY_DEBUG, + _ => TEXT_COLOR, + }) .set(state.ids.mmap_site_icons[i], ui); + + // Difficulty from 0-6 + // 0 = towns and places without a difficulty level + // TODO: Pass actual difficulty in here + if self.show.map_difficulty { + + let size = 1.8; // Size factor for difficulty indicators + let dif_img = Image::new(match dif { + 1 => self.imgs.map_dif_0, + 2 => self.imgs.map_dif_1, + 3 => self.imgs.map_dif_2, + 4 => self.imgs.map_dif_3, + 5 => self.imgs.map_dif_4, + 6 => self.imgs.map_dif_5, + _ => self.imgs.nothing, + }) + .mid_top_with_margin_on(state.ids.mmap_site_icons[i], match dif { + 6 => -12.0 * size, + _ => -4.0 * size, + }) + .w(match dif { + 6 => 12.0 * size, + _ => 4.0 * size * dif as f64, + }) + .h(match dif { + 6 => 12.0 * size, + _ => 4.0 * size, + }) + .color(Some(match dif { + 1 => QUALITY_LOW, + 2 => QUALITY_COMMON, + 3 => QUALITY_MODERATE, + 4 => QUALITY_HIGH, + 5 => QUALITY_EPIC, + 6 => TEXT_COLOR, + _ => TEXT_COLOR, + } + ) + ); + match &site.kind { + SiteKind::Town => if self.show.map_towns {dif_img.set(state.ids.site_difs[i], ui) }, + SiteKind::Dungeon => if self.show.map_dungeons {dif_img.set(state.ids.site_difs[i], ui)}, + SiteKind::Castle => if self.show.map_castles {dif_img.set(state.ids.site_difs[i], ui)}, + } + } + } // Cursor pos relative to playerpos and widget size diff --git a/voxygen/src/hud/minimap.rs b/voxygen/src/hud/minimap.rs index 57c069bd53..9e6c1bc788 100644 --- a/voxygen/src/hud/minimap.rs +++ b/voxygen/src/hud/minimap.rs @@ -292,8 +292,7 @@ impl<'a> Widget for MiniMap<'a> { Color::Rgba(0.75, 0.0, 0.0, 1.0) } else { TEXT_COLOR - }) - .floating(true) + }) .parent(ui.window) .set(*id, ui); } diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 15f37f33b8..4cd1d6f52f 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -148,7 +148,6 @@ const DEFAULT_NPC: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0); const UI_MAIN: Color = Color::Rgba(0.61, 0.70, 0.70, 1.0); // Greenish Blue //const UI_MAIN: Color = Color::Rgba(0.1, 0.1, 0.1, 0.97); // Dark const UI_HIGHLIGHT_0: Color = Color::Rgba(0.79, 1.09, 1.09, 1.0); -const UI_GOLD: Color = Color::Rgba(0.75, 0.58, 0.0, 1.0); // Pull-Down menu BG color const MENU_BG: Color = Color::Rgba(0.1, 0.12, 0.12, 1.0); //const UI_DARK_0: Color = Color::Rgba(0.25, 0.37, 0.37, 1.0); @@ -450,6 +449,10 @@ pub struct Show { stats: bool, free_look: bool, auto_walk: bool, + map_difficulty: bool, + map_towns: bool, + map_castles: bool, + map_dungeons: bool, } impl Show { fn bag(&mut self, open: bool) { @@ -463,7 +466,7 @@ impl Show { fn toggle_bag(&mut self) { self.bag(!self.bag); } fn map(&mut self, open: bool) { - if !self.esc_menu { + if !self.esc_menu { self.map = open; self.bag = false; self.crafting = false; @@ -499,7 +502,8 @@ impl Show { } } - fn toggle_map(&mut self) { self.map(!self.map) } + fn toggle_map(&mut self) { + self.map(!self.map) } fn toggle_mini_map(&mut self) { self.mini_map = !self.mini_map; } @@ -713,6 +717,10 @@ impl Hud { stats: false, free_look: false, auto_walk: false, + map_difficulty: true, + map_towns: true, + map_castles: true, + map_dungeons: true, }, to_focus: None, //never_show: false, @@ -2262,6 +2270,18 @@ impl Hud { self.show.want_grab = true; self.force_ungrab = false; }, + map::Event::ShowDifficulties => { + self.show.map_difficulty = !self.show.map_difficulty + }, + map::Event::ShowTowns => { + self.show.map_towns = !self.show.map_towns + }, + map::Event::ShowCastles => { + self.show.map_castles = !self.show.map_castles + }, + map::Event::ShowDungeons => { + self.show.map_dungeons = !self.show.map_dungeons + }, map::Event::MapZoom(map_zoom) => { events.push(Event::MapZoom(map_zoom)); },