public static void Load() { _player = null; // A border to put around the text block Border blockBorder = new Border(); blockBorder.BorderBrush = Brushes.Black; blockBorder.BorderThickness = new Thickness(1.0); blockBorder.Padding = new Thickness(8.0); // A text block using the HS font _info = new HearthstoneTextBlock(); _info.Text = ""; _info.FontSize = 18; // Add the text block as a child of the border element blockBorder.Child = _info; // Create an image at the corner of the text bloxk Image image = new Image(); // Create the image source BitmapImage bi = new BitmapImage(new Uri("pack://siteoforigin:,,,/Plugins/card.png")); // Set the image source image.Source = bi; // Get the HDT Overlay canvas object var canvas = Core.OverlayCanvas; // Get canvas centre var fromTop = canvas.Height / 2; var fromLeft = canvas.Width / 2; // Give the text block its position within the canvas, roughly in the center Canvas.SetTop(blockBorder, fromTop); Canvas.SetLeft(blockBorder, fromLeft); // Give the text block its position within the canvas Canvas.SetTop(image, fromTop - 12); Canvas.SetLeft(image, fromLeft - 12); // Add the text block and image to the canvas canvas.Children.Add(blockBorder); canvas.Children.Add(image); // Register methods to be called when GameEvents occur GameEvents.OnGameStart.Add(NewGame); GameEvents.OnPlayerDraw.Add(HandInfo); }
public static void Load() { _player = null; // A text block using the HS font _info = new HearthstoneTextBlock(); _info.Text = ""; _info.FontSize = 18; // Get the HDT Overlay canvas object var canvas = Overlay.OverlayCanvas; // Give the text block its position within the canvas Canvas.SetTop(_info, canvas.Height / 2); Canvas.SetLeft(_info, canvas.Width / 2); // Add the text block to the canvas canvas.Children.Add(_info); // Register methods to be called when GameEvents occur GameEvents.OnGameStart.Add(NewGame); GameEvents.OnPlayerDraw.Add(HandInfo); }
private void RemoveElements() { // Value overlay for (int i = 0; i < valueoverlays.Count; i++) { Hearthstone_Deck_Tracker.API.Core.OverlayCanvas.Children.Remove(valueoverlays[i]); } valueoverlays.Clear(); // Advice overlay if (adviceoverlay != null) { Hearthstone_Deck_Tracker.API.Core.OverlayCanvas.Children.Remove(adviceoverlay); adviceoverlay = null; } if (testtext != null) { Hearthstone_Deck_Tracker.API.Core.OverlayCanvas.Children.Remove(testtext); testtext = null; } for (int i = 0; i < testimages.Count; i++) { Hearthstone_Deck_Tracker.API.Core.OverlayCanvas.Children.Remove(testimages[i]); } testimages.Clear(); }
// Add overlay elements for debugging private void AddElements() { // Value overlay if (valueoverlays.Count == 0) { for (int i = 0; i < 3; i++) { ArenaHelper.Controls.ValueOverlay valuetext = new ArenaHelper.Controls.ValueOverlay(); valuetext.ValueText.Text = "Value"; Canvas.SetLeft(valuetext, 5); Canvas.SetTop(valuetext, 5); Hearthstone_Deck_Tracker.API.Core.OverlayCanvas.Children.Add(valuetext); valuetext.Visibility = System.Windows.Visibility.Hidden; valueoverlays.Add(valuetext); } } // Advice overlay if (adviceoverlay == null) { adviceoverlay = new ArenaHelper.Controls.AdviceOverlay(); adviceoverlay.AdviceText.Text = ""; Canvas.SetLeft(adviceoverlay, 5); Canvas.SetTop(adviceoverlay, 5); Hearthstone_Deck_Tracker.API.Core.OverlayCanvas.Children.Add(adviceoverlay); adviceoverlay.Visibility = System.Windows.Visibility.Hidden; } // Test text if (testtext == null) { testtext = new HearthstoneTextBlock(); testtext.FontSize = 12; testtext.Text = "Arena Helper"; Canvas.SetLeft(testtext, 5); Canvas.SetTop(testtext, 5); Hearthstone_Deck_Tracker.API.Core.OverlayCanvas.Children.Add(testtext); testtext.Visibility = System.Windows.Visibility.Hidden; } // Test images if (testimages.Count == 0) { for (int i = 0; i < 4; i++) { System.Windows.Controls.Image testimage = new System.Windows.Controls.Image(); Canvas.SetLeft(testimage, 5 + i * 210); Canvas.SetTop(testimage, 550); Hearthstone_Deck_Tracker.API.Core.OverlayCanvas.Children.Add(testimage); testimage.Visibility = System.Windows.Visibility.Hidden; testimages.Add(testimage); } } }
public static void Load() { _player = null; //String[] fileNames = Directory.GetFiles("Sample Decks", "*.txt"); /* TODO: Add automatic deck importing of Sample Decks after newest HDT Update foreach (String fileName in fileNames) { try { Deck deck = null; if (fileName.EndsWith(".txt")) { using (var sr = new StreamReader(fileName)) deck = Core.MainWindow.ParseCardString(sr.ReadToEnd()); } else if (fileName.EndsWith(".xml")) { deck = XmlManager<Deck>.Load(fileName); //not all required information is saved in xml foreach (var card in deck.Cards) card.Load(); TagControlEdit.SetSelectedTags(deck.Tags); } SetNewDeck(deck); if (Config.Instance.AutoSaveOnImport) SaveDeckWithOverwriteCheck(); } catch (Exception ex) { Logger.WriteLine("Error getting deck from file: \n" + ex, "Import"); } }*/ // A border to put around the text block Border blockBorder = new Border(); blockBorder.BorderBrush = Brushes.Black; blockBorder.BorderThickness = new Thickness(1.0); blockBorder.Padding = new Thickness(8.0); // A text block using the HS font _info = new HearthstoneTextBlock(); _info.Text = ""; _info.FontSize = 18; // Add the text block as a child of the border element blockBorder.Child = _info; // Create an image at the corner of the text bloxk Image image = new Image(); // Create the image source BitmapImage bi = new BitmapImage(new Uri("pack://siteoforigin:,,,/Plugins/card.png")); // Set the image source image.Source = bi; // Get the HDT Overlay canvas object var canvas = Core.OverlayCanvas; // Get canvas centre var fromTop = canvas.Height / 2; var fromLeft = canvas.Width / 2; // Give the text block its position within the canvas, roughly in the center Canvas.SetTop(blockBorder, fromTop); Canvas.SetLeft(blockBorder, fromLeft); // Give the text block its position within the canvas Canvas.SetTop(image, fromTop - 12); Canvas.SetLeft(image, fromLeft - 12); // Add the text block and image to the canvas canvas.Children.Add(blockBorder); canvas.Children.Add(image); // Register methods to be called when GameEvents occur GameEvents.OnGameStart.Add(NewGame); GameEvents.OnPlayerDraw.Add(DeckInfo); GameEvents.OnGameEnd.Add(analyzeDeck); }