-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunitDialogue.cs
More file actions
82 lines (74 loc) · 2.2 KB
/
Copy pathunitDialogue.cs
File metadata and controls
82 lines (74 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
namespace WpfApp1
{
public class unitDialogue
{
public int no;
public StringBuilder dialogue;
public List<path> paths;
public List<path> from;
public ContextMenu cm;
public int contextItemSelected;
public unitDialogue(int p1)
{
dialogue = new StringBuilder("AYYY");
paths = new List<path>();
from = new List<path>();
cm = new ContextMenu();
contextItemSelected = -1;
no = p1;
defaultContextInit();
deleteContextInit();
}
public void defaultContextInit()
{
MenuItem lmao = new MenuItem();
lmao.Header = "Default";
lmao.Click += linker;
lmao.Tag = 0;
cm.Items.Add(lmao);
paths.Add(new path("Default"));
}
public void deleteContextInit()
{
MenuItem delet = new MenuItem();
delet.Header = "Delete";
delet.Tag = paths.Count;
delet.Click += linker;
cm.Items.Add(delet);
}
public void ContextBuilder()
{
cm.Items.Clear();
for (int i = 0; i < paths.Count; i++)
{
MenuItem lmao = new MenuItem();
lmao.Header = paths[i].optname.ToString();
if (paths[i].line != null)
{
lmao.IsEnabled = false;
}
lmao.Click += linker;
lmao.Tag = i;
cm.Items.Add(lmao);
}
deleteContextInit();
}
public void linker(object sender, RoutedEventArgs e)
{
MenuItem temp = sender as MenuItem;
int index = int.Parse(temp.Tag.ToString());
contextItemSelected = index;
}
public void pathLinker(unitDialogue to)
{
if (contextItemSelected == -1)
return;
paths[contextItemSelected].next = to;
to.from.Add(this.paths[contextItemSelected]);
}
}
}