private void add_Dialogue(object sender, RoutedEventArgs e) { Button newBtn = new Button(); newBtn.Height = 32; newBtn.Width = 150; newBtn.Style = (Style)this.FindResource("MaterialDesignFlatLightBgButton"); newBtn.Content = "Dialogue " + nodecount.ToString(); unitDialogue obj = new unitDialogue(nodecount); nodecount++; Button_obj_Map.Add(newBtn, obj); btn_mapper(newBtn); Point p = Mouse.GetPosition(jesus); Canvas.SetLeft(newBtn, p.X - 10); Canvas.SetTop(newBtn, p.Y - 10); jesus.Children.Add(newBtn); if (head == null) { head = obj; } }
public void lineCreator(unitDialogue from, unitDialogue to) { Line line = new Line(); line.Stroke = System.Windows.Media.Brushes.LightSteelBlue; line.StrokeThickness = 5; Canvas.SetZIndex(line, -1); var c1 = lineCreator_coordinatesHelper(from); var c2 = lineCreator_coordinatesHelper(to); lineCoordinatesUpdater(line, c1.Item1, c1.Item2, 1); lineCoordinatesUpdater(line, c2.Item1, c2.Item2, 2); List <unitDialogue> connx = new List <unitDialogue>(); connx.Add(from); connx.Add(to); line.Tag = connx; line.MouseRightButtonDown += new MouseButtonEventHandler(lineDeleter); linkfrom.paths[linkfrom.contextItemSelected].line = line; linkfrom.ContextBuilder(); linkfrom.contextItemSelected = -1; jesus.Children.Add(line); }
public Tuple <double, double> lineCreator_coordinatesHelper(unitDialogue lmao) { Button temp = getKey(lmao); double X1 = Canvas.GetLeft(temp) + 75; double Y1 = Canvas.GetTop(temp) + 16; return(new Tuple <double, double>(X1, Y1)); }
public void pathLinker(unitDialogue to) { if (contextItemSelected == -1) { return; } paths[contextItemSelected].next = to; to.from.Add(this.paths[contextItemSelected]); }
public void refresher(unitDialogue pointa) { open = pointa; hmm.Children.Clear(); slave.Content = null; enterDialogue.Text = pointa.dialogue.ToString(); dialogName.Content = "Dialogue " + open.no.ToString(); hmm.Children.Add(dialogName); hmm.Children.Add(enterDialogue); hmm.Children.Add(addOpt); listBuilder(pointa); }
public Button getKey(unitDialogue param) { Button temp = null; foreach (KeyValuePair <Button, object> entry in Button_obj_Map) { if (entry.Value == param) { temp = entry.Key; } } return(temp); }
public DialogueEditor() { mw = (MainWindow)Application.Current.MainWindow; open = null; hmm = new StackPanel(); opts = new ListView(); slave = new ScrollViewer(); slave.Height = 190; slave.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; headerLabelInit(); enterDialogueInit(); addOptInit(); }
private void btn_mapper(object sender) { Button pointa = sender as Button; pointa.Click += btn_simpleclick; pointa.PreviewMouseLeftButtonDown += btn_PreviewMouseLeftButtonDown; pointa.PreviewMouseLeftButtonUp += btn_PreviewMouseLeftButtonUp; pointa.PreviewMouseMove += btn_PreviewMouseMove; unitDialogue temp = getUnitDialogueFromButton(pointa) as unitDialogue; pointa.ContextMenu = temp.cm; pointa.ContextMenuOpening += linkfrom_init; pointa.ContextMenuClosing += problem_handler; }
public void listBuilder(unitDialogue pointa) { ListView temp = new ListView(); for (int i = 0; i < pointa.paths.Count; i++) { ListViewItem lmao = new ListViewItem(); StackPanel cols = new StackPanel(); cols.Orientation = Orientation.Horizontal; Label nums = new Label(); nums.Content = (i + 1).ToString() + ".)"; nums.Margin = new Thickness(10, 0, 100, 0); cols.Children.Add(nums); TextBox optname = new TextBox(); optname.Width = 200; optname.Text = pointa.paths[i].optname.ToString(); optname.Tag = pointa.paths[i]; optname.TextChanged += editOption; cols.Children.Add(optname); Label pointername = new Label(); pointername.Width = 200; pointername.Content = (pointa.paths[i].next != null ? ("Dialogue " + pointa.paths[i].next.no.ToString()) : "Null"); pointername.Margin = new Thickness(100, 0, 100, 0); cols.Children.Add(pointername); Button deleter = new Button(); MaterialDesignThemes.Wpf.PackIcon b = new MaterialDesignThemes.Wpf.PackIcon(); b.Kind = MaterialDesignThemes.Wpf.PackIconKind.Delete; deleter.Content = b; deleter.Style = (Style)mw.FindResource("MaterialDesignIconForegroundButton"); deleter.Width = 26; deleter.Height = 26; deleter.Tag = pointa.paths[i]; deleter.Margin = new Thickness(100, 0, 0, 0); deleter.Click += deleteOption; cols.Children.Add(deleter); lmao.Content = cols; temp.Items.Add(lmao); } slave.Content = temp; hmm.Children.Add(slave); }
public MainWindow() { only = new DialogueEditor(); head = null; IsDragging = false; Button_obj_Map = new Dictionary <Button, object>(); nodecount = 0; scaler = new ScaleTransform(); prevOpen = null; InitializeComponent(); jesus.LayoutTransform = scaler; jesus.MouseWheel += scale_Canvas; linkfrom = null; linkto = null; SidePanel.Children.Add(only.hmm); }
public void lineUpdater(Button temp, MouseEventArgs e) { unitDialogue slave = getUnitDialogueFromButton(temp) as unitDialogue; Point lmao = e.GetPosition(temp); Point canvasRelativePosition = e.GetPosition(jesus); for (int i = 0; i < slave.from.Count; i++) { lineCoordinatesUpdater(slave.from[i].line, canvasRelativePosition.X - lmao.X + 75, canvasRelativePosition.Y - lmao.Y + 16, 2); } for (int i = 0; i < slave.paths.Count; i++) { if (slave.paths[i].line != null) { lineCoordinatesUpdater(slave.paths[i].line, canvasRelativePosition.X - lmao.X + 75, canvasRelativePosition.Y - lmao.Y + 16, 1); } } }
public void problem_handler(object sender, ContextMenuEventArgs e) { Button temp = sender as Button; if (linkfrom != null) { if (linkfrom.contextItemSelected == -1) { linkfrom = null; } else if (linkfrom.contextItemSelected == linkfrom.paths.Count) { jesus.Children.Remove(temp); while (linkfrom.paths.Count > 0) { if (linkfrom.paths[0].line == null) { linkfrom.paths.RemoveAt(0); } else { lineDeleter(linkfrom.paths[0].line, null); } } while (linkfrom.from.Count > 0) { lineDeleter(linkfrom.from[0].line, null); } linkfrom.paths = null; linkfrom.from = null; Button_obj_Map.Remove(temp); linkfrom = null; } else { var converter = new System.Windows.Media.BrushConverter(); var brush = (Brush)converter.ConvertFromString("#f5f0ff"); jesus.Background = brush; } } }
private void btn_simpleclick(object sender, RoutedEventArgs e) { Button temp = sender as Button; unitDialogue next = getUnitDialogueFromButton(sender) as unitDialogue; if (linkfrom == null) { if (only.open != null) { only.open.dialogue.Clear(); only.open.dialogue.Append(only.enterDialogue.Text); } only.open = next; only.refresher(only.open); } else { linkto = next; if (linkfrom.Equals(linkto) || linkfrom.contextItemSelected == -1) { linkfrom = null; linkto = null; return; } linkfrom.pathLinker(linkto); lineCreator(linkfrom, linkto); linkfrom = null; linkto = null; jesus.Background = new SolidColorBrush(Colors.GhostWhite); } if (prevOpen != null) { prevOpen.Style = (Style)this.FindResource("MaterialDesignFlatLightBgButton"); } temp.Style = (Style)this.FindResource("MaterialDesignFlatDarkBgButton"); prevOpen = temp; }
public void linkfrom_init(object sender, ContextMenuEventArgs e) { linkfrom = getUnitDialogueFromButton(sender); }
public path(String text) { optname = new StringBuilder(text); line = null; next = null; }