private Panel BuildSettingPanel(Rectangle panelBounds) { var etPanel = new Panel() { CanScroll = false, Size = panelBounds.Size }; var ddSortMethod = new Dropdown() { Location = new Point(etPanel.Right - 150 - Dropdown.Standard.ControlOffset.X, Dropdown.Standard.ControlOffset.Y), Width = 150, Parent = etPanel, }; int topOffset = ddSortMethod.Bottom + Panel.MenuStandard.ControlOffset.Y; var menuSection = new Panel { Title = "Event Categories", ShowBorder = true, Size = Panel.MenuStandard.Size - new Point(0, topOffset + Panel.MenuStandard.ControlOffset.Y), Location = new Point(Panel.MenuStandard.PanelOffset.X, topOffset), Parent = etPanel }; var eventPanel = new FlowPanel() { FlowDirection = ControlFlowDirection.LeftToRight, ControlPadding = new Vector2(8, 8), Location = new Point(menuSection.Right + Panel.MenuStandard.ControlOffset.X, menuSection.Top), Size = new Point(ddSortMethod.Right - menuSection.Right - Control.ControlStandard.ControlOffset.X, menuSection.Height), CanScroll = true, Parent = etPanel }; GameService.Overlay.QueueMainThreadUpdate((gameTime) => { var searchBox = new TextBox() { PlaceholderText = "Event Search", Width = menuSection.Width, Location = new Point(ddSortMethod.Top, menuSection.Left), Parent = etPanel }; searchBox.TextChanged += delegate(object sender, EventArgs args) { eventPanel.FilterChildren <DetailsButton>(db => db.Text.ToLower().Contains(searchBox.Text.ToLower())); }; }); foreach (var meta in Meta.Events) { var setting = _watchCollection.DefineSetting("watchEvent:" + meta.Name, true); meta.IsWatched = setting.Value; var es2 = new DetailsButton { Parent = eventPanel, BasicTooltipText = meta.Category, Text = meta.Name, IconSize = DetailsIconSize.Small, ShowVignette = false, HighlightType = DetailsHighlightType.LightHighlight, ShowToggleButton = true }; if (meta.Texture.HasTexture) { es2.Icon = meta.Texture; } var nextTimeLabel = new Label() { Size = new Point(65, es2.ContentRegion.Height), Text = meta.NextTime.ToShortTimeString(), BasicTooltipText = GetTimeDetails(meta), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Middle, Parent = es2, }; Adhesive.Binding.CreateOneWayBinding(() => nextTimeLabel.Height, () => es2.ContentRegion, (rectangle => rectangle.Height), true); if (!string.IsNullOrEmpty(meta.Wiki)) { var glowWikiBttn = new GlowButton { Icon = GameService.Content.GetTexture("102530"), ActiveIcon = GameService.Content.GetTexture("glow-wiki"), BasicTooltipText = "Read about this event on the wiki.", Parent = es2, GlowColor = Color.White * 0.1f }; glowWikiBttn.Click += delegate { if (UrlIsValid(meta.Wiki)) { Process.Start(meta.Wiki); } }; } if (!string.IsNullOrEmpty(meta.Waypoint)) { var glowWaypointBttn = new GlowButton { Icon = GameService.Content.GetTexture("waypoint"), ActiveIcon = GameService.Content.GetTexture("glow-waypoint"), BasicTooltipText = $"Nearby waypoint: {meta.Waypoint}", Parent = es2, GlowColor = Color.White * 0.1f }; glowWaypointBttn.Click += delegate { System.Windows.Forms.Clipboard.SetText(meta.Waypoint); ScreenNotification.ShowNotification("Waypoint copied to clipboard."); }; } var toggleFollowBttn = new GlowButton() { Icon = _textureWatch, ActiveIcon = _textureWatchActive, BasicTooltipText = "Click to toggle tracking for this event.", ToggleGlow = true, Checked = meta.IsWatched, Parent = es2, }; toggleFollowBttn.Click += delegate { meta.IsWatched = toggleFollowBttn.Checked; setting.Value = toggleFollowBttn.Checked; }; meta.OnNextRunTimeChanged += delegate { UpdateSort(ddSortMethod, EventArgs.Empty); nextTimeLabel.Text = meta.NextTime.ToShortTimeString(); nextTimeLabel.BasicTooltipText = GetTimeDetails(meta); }; _displayedEvents.Add(es2); } // Add menu items for each category (and built-in categories) var eventCategories = new Menu { Size = menuSection.ContentRegion.Size, MenuItemHeight = 40, Parent = menuSection, CanSelect = true }; List <IGrouping <string, Meta> > submetas = Meta.Events.GroupBy(e => e.Category).ToList(); var evAll = eventCategories.AddMenuItem(EC_ALLEVENTS); evAll.Select(); evAll.Click += delegate { eventPanel.FilterChildren <DetailsButton>(db => true); }; foreach (IGrouping <string, Meta> e in submetas) { var ev = eventCategories.AddMenuItem(e.Key); ev.Click += delegate { eventPanel.FilterChildren <DetailsButton>(db => string.Equals(db.BasicTooltipText, e.Key)); }; } // TODO: Hidden events/timers to be added later //eventCategories.AddMenuItem(EC_HIDDEN); // Add dropdown for sorting events ddSortMethod.Items.Add(DD_ALPHABETICAL); ddSortMethod.Items.Add(DD_NEXTUP); ddSortMethod.ValueChanged += delegate(object sender, ValueChangedEventArgs args) { switch (args.CurrentValue) { case DD_ALPHABETICAL: eventPanel.SortChildren <DetailsButton>((db1, db2) => string.Compare(db1.Text, db2.Text, StringComparison.CurrentCultureIgnoreCase)); break; case DD_NEXTUP: break; } }; ddSortMethod.SelectedItem = DD_NEXTUP; //UpdateSort(ddSortMethod, EventArgs.Empty); return(etPanel); }
private Panel BuildHomePanel(WindowBase wndw) { var tdPanel = new Panel() { CanScroll = false, Size = wndw.ContentRegion.Size }; int topOffset = 40 + Panel.MenuStandard.ControlOffset.Y; var menuSection = new Panel { Title = "Event Categories", ShowBorder = true, Size = Panel.MenuStandard.Size - new Point(0, +topOffset + Panel.MenuStandard.ControlOffset.Y), Location = new Point(Panel.MenuStandard.PanelOffset.X, topOffset), Parent = tdPanel }; var mainPanel = new FlowPanel() { FlowDirection = ControlFlowDirection.LeftToRight, Location = new Point(menuSection.Right + Panel.MenuStandard.ControlOffset.X, menuSection.Top), Size = new Point(tdPanel.Right - menuSection.Right - (Control.ControlStandard.ControlOffset.X * 2), menuSection.Height), CanScroll = false, Parent = tdPanel, }; var taskPanel = new FlowPanel() { FlowDirection = ControlFlowDirection.LeftToRight, ControlPadding = new Vector2(8, 8), //Location = new Point(menuSection.Right + Panel.MenuStandard.ControlOffset.X, menuSection.Top), Size = new Point(tdPanel.Right - menuSection.Right - (Control.ControlStandard.ControlOffset.X * 2), menuSection.Height - 70), CanScroll = true, Parent = mainPanel, }; GameService.Overlay.QueueMainThreadUpdate((gameTime) => { var searchBox = new TextBox() { PlaceholderText = "Filter Tasks", Width = menuSection.Width, Location = new Point(menuSection.Left, TextBox.Standard.ControlOffset.Y), Parent = tdPanel }; searchBox.TextChanged += delegate(object sender, EventArgs args) { taskPanel.FilterChildren <DetailsButton>(db => db.Text.ToLower().Contains(searchBox.Text.ToLower())); }; }); foreach (var task in tdTask.Tasks) { var es2 = new DetailsButton { Parent = taskPanel, BasicTooltipText = task.Category, Text = task.Description, IconSize = DetailsIconSize.Small, ShowVignette = false, HighlightType = DetailsHighlightType.LightHighlight, ShowToggleButton = true }; if (task.Texture.HasTexture) { es2.Icon = task.Texture; } _displayedTasks.Add(es2); } var actionPanel = new FlowPanel() { Size = new Point(taskPanel.Width, 50), CanScroll = false, FlowDirection = ControlFlowDirection.LeftToRight, ShowBorder = false, Parent = mainPanel, ControlPadding = new Vector2(8, 8) //BackgroundColor = Microsoft.Xna.Framework.Color.Black }; var newTaskButton = new StandardButton { Parent = actionPanel, Text = "New Task" }; //Create new panel to switch to var newtaskPanel = BuildNewTaskPanel(wndw); newTaskButton.LeftMouseButtonReleased += delegate { wndw.Navigate(newtaskPanel, true); }; //Add categories var taskCategories = new Menu { Size = menuSection.ContentRegion.Size, MenuItemHeight = 40, Parent = menuSection, CanSelect = true }; List <IGrouping <string, tdTask> > submetas = tdTask.Tasks.GroupBy(e => e.Category).ToList(); var evAll = taskCategories.AddMenuItem(EC_ALLEVENTS); evAll.Select(); evAll.Click += delegate { taskPanel.FilterChildren <DetailsButton>(db => true); }; foreach (IGrouping <string, tdTask> e in submetas) { var ev = taskCategories.AddMenuItem(e.Key); ev.Click += delegate { taskPanel.FilterChildren <DetailsButton>(db => string.Equals(db.BasicTooltipText, e.Key)); }; } return(tdPanel); }