forked from DivverGit/Daedalus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UI.cs
181 lines (174 loc) · 7.65 KB
/
UI.cs
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
using Daedalus.Controllers;
using Daedalus.Routines;
using Daedalus.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Daedalus.Data;
namespace Daedalus
{
public partial class UI : Form
{
public UI()
{
InitializeComponent();
}
private void UI_Load(object sender, EventArgs e)
{
Daedalus Daedalus = new Daedalus(this);
double newValue = Settings.Default.movementRange;
orbitTrackbar_Update(newValue);
movementComboBox.SelectedIndex = Settings.Default.movementIndex;
propulsionComboBox.SelectedIndex = Settings.Default.propulsionIndex;
targetingComboBox.SelectedIndex = Settings.Default.targetingIndex;
}
// Labels
public void changeStatusLabel(StatusLabel label, string value)
{
if(label == StatusLabel.shipName) shipNameValueLabel.Text = value;
else if (label == StatusLabel.shield) shieldValueLabel.Text = value;
else if (label == StatusLabel.armor) armorValueLabel.Text = value;
else if (label == StatusLabel.hull) hullValueLabel.Text = value;
else if (label == StatusLabel.hiSlot1) hiSlot1ValueLabel.Text = value;
else if (label == StatusLabel.hiSlot2) hiSlot2ValueLabel.Text = value;
else if (label == StatusLabel.hiSlot3) hiSlot3ValueLabel.Text = value;
else if (label == StatusLabel.hiSlot4) hiSlot4ValueLabel.Text = value;
else if (label == StatusLabel.hiSlot5) hiSlot5ValueLabel.Text = value;
else if (label == StatusLabel.hiSlot6) hiSlot6ValueLabel.Text = value;
else if (label == StatusLabel.hiSlot7) hiSlot7ValueLabel.Text = value;
else if (label == StatusLabel.hiSlot8) hiSlot8ValueLabel.Text = value;
else if (label == StatusLabel.medSlot1) medSlot1ValueLabel.Text = value;
else if (label == StatusLabel.medSlot2) medSlot2ValueLabel.Text = value;
else if (label == StatusLabel.medSlot3) medSlot3ValueLabel.Text = value;
else if (label == StatusLabel.medSlot4) medSlot4ValueLabel.Text = value;
else if (label == StatusLabel.medSlot5) medSlot5ValueLabel.Text = value;
else if (label == StatusLabel.medSlot6) medSlot6ValueLabel.Text = value;
else if (label == StatusLabel.medSlot7) medSlot7ValueLabel.Text = value;
else if (label == StatusLabel.medSlot8) medSlot8ValueLabel.Text = value;
}
public void changeStatusLabelColour(StatusLabel label, Color color)
{
if (label == StatusLabel.shipName) shipNameValueLabel.ForeColor = color;
else if (label == StatusLabel.shield) shieldValueLabel.ForeColor = color;
else if (label == StatusLabel.armor) armorValueLabel.ForeColor = color;
else if (label == StatusLabel.hull) hullValueLabel.ForeColor = color;
else if (label == StatusLabel.hiSlot1) hiSlot1ValueLabel.ForeColor = color;
else if (label == StatusLabel.hiSlot2) hiSlot2ValueLabel.ForeColor = color;
else if (label == StatusLabel.hiSlot3) hiSlot3ValueLabel.ForeColor = color;
else if (label == StatusLabel.hiSlot4) hiSlot4ValueLabel.ForeColor = color;
else if (label == StatusLabel.hiSlot5) hiSlot5ValueLabel.ForeColor = color;
else if (label == StatusLabel.hiSlot6) hiSlot6ValueLabel.ForeColor = color;
else if (label == StatusLabel.hiSlot7) hiSlot7ValueLabel.ForeColor = color;
else if (label == StatusLabel.hiSlot8) hiSlot8ValueLabel.ForeColor = color;
else if (label == StatusLabel.medSlot1) medSlot1ValueLabel.ForeColor = color;
else if (label == StatusLabel.medSlot2) medSlot2ValueLabel.ForeColor = color;
else if (label == StatusLabel.medSlot3) medSlot3ValueLabel.ForeColor = color;
else if (label == StatusLabel.medSlot4) medSlot4ValueLabel.ForeColor = color;
else if (label == StatusLabel.medSlot5) medSlot5ValueLabel.ForeColor = color;
else if (label == StatusLabel.medSlot6) medSlot6ValueLabel.ForeColor = color;
else if (label == StatusLabel.medSlot7) medSlot7ValueLabel.ForeColor = color;
else if (label == StatusLabel.medSlot8) medSlot8ValueLabel.ForeColor = color;
}
// Preferences
public static TargetingProfile selectedTargetingProfile = TargetingProfile.byDistance;
private void orbitTrackbar_Scroll(object sender, EventArgs e)
{
double newValue = orbitTrackbar.Value;
orbitTrackbar_Update(newValue);
}
private void orbitTrackbar_Update(double newValue)
{
orbitTrackbar.Value = Convert.ToInt32(newValue);
orbitValueLabel.Text = newValue.ToString() + "m";
Settings.Default.movementRange = newValue;
Settings.Default.Save();
}
private void movementComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (movementComboBox.SelectedIndex == 0) Settings.Default.movementIndex = 0;
else if (movementComboBox.SelectedIndex == 1) Settings.Default.movementIndex = 1;
Settings.Default.Save();
}
private void propulsionComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (propulsionComboBox.SelectedIndex == 0) Settings.Default.propulsionIndex = 0;
else if (propulsionComboBox.SelectedIndex == 1) Settings.Default.propulsionIndex = 1;
Settings.Default.Save();
}
private void targetingComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (targetingComboBox.SelectedIndex == 0)
{
selectedTargetingProfile = TargetingProfile.byClass;
Settings.Default.targetingIndex = 0;
}
else if (targetingComboBox.SelectedIndex == 1)
{
selectedTargetingProfile = TargetingProfile.byDistance;
Settings.Default.targetingIndex = 1;
}
Settings.Default.Save();
}
// Log & Targets
public void newConsoleMessage(string input)
{
Console.Items.Add("(" + DateTime.Now.ToString("HH:mm:ss") + ") " + input);
Console.SelectedIndex = (Console.Items.Count - 1);
}
public void setTargetsList(List<EnemyNPC> targets)
{
targetsListBox.Items.Clear();
foreach (EnemyNPC target in targets)
{
targetsListBox.Items.Add(target.entity.Name + " (" + target.shipClass + ") - " + target.distance.ToString("#") + "m - isPriority=" + target.isPriority.ToString());
}
targetsListBox.Refresh();
}
private void copyToClipboardToolStripMenuItem_Click(object sender, EventArgs e)
{
string toCopy = "";
foreach(var line in Console.Items)
{
toCopy += line + "\n";
}
Clipboard.SetText(toCopy);
}
}
public enum StatusLabel
{
shipName,
shield,
armor,
hull,
hiSlot1,
hiSlot2,
hiSlot3,
hiSlot4,
hiSlot5,
hiSlot6,
hiSlot7,
hiSlot8,
medSlot1,
medSlot2,
medSlot3,
medSlot4,
medSlot5,
medSlot6,
medSlot7,
medSlot8,
loSlot1,
loSlot2,
loSlot3,
loSlot4,
loSlot5,
loSlot6,
loSlot7,
loSlot8
}
public enum TargetingProfile
{
byClass,
byDistance
}
}