-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathKeywordPicker.cs
59 lines (49 loc) · 2.52 KB
/
KeywordPicker.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
using System.Windows.Forms;
namespace fCraft.ConfigGUI {
public sealed partial class KeywordPicker : Form {
public string Result;
private readonly ToolTip tips;
private static readonly KeywordInfo[] Keywords = new[]{
new KeywordInfo("{SERVER_NAME}", "Server name", "Name of your server, as specified in config." ),
new KeywordInfo("{RANK}", "Player's rank", "Player's rank, including prefix and colors (if applicable)." ),
new KeywordInfo("{PLAYER_NAME}", "Player's name", "Name of the player, including prefix and colors (if applicable)." ),
new KeywordInfo("{TIME}", "Time", "Current time (server clock)."),
new KeywordInfo("{WORLD}", "Main world name","Name of the main/starting world, including prefix and colors (if applicable)." ),
new KeywordInfo("{PLAYERS}", "Number of players online", "Note that hidden players will not be included in this number." ),
new KeywordInfo("{WORLDS}", "Number of worlds", "Number of worlds accessible by the player. Does not count hidden worlds." ),
new KeywordInfo("{MOTD}", "MOTD", "Message-of-the-day (server subtitle), as specified in config." ),
new KeywordInfo("{VERSION}", "800Craft version", "Version of 800Craft that this server is running." )
};
private const int ButtonWidth = 150,
ButtonHeight = 28;
public KeywordPicker() {
InitializeComponent();
tips = new ToolTip();
foreach ( KeywordInfo keyword in Keywords ) {
Button newButton = new Button {
Text = keyword.LongName,
Tag = keyword.Keyword,
Width = ButtonWidth,
Height = ButtonHeight
};
pFlow.Controls.Add( newButton );
newButton.Click += delegate {
Result = ( string )newButton.Tag;
DialogResult = DialogResult.OK;
Close();
};
tips.SetToolTip( newButton, keyword.Description );
}
}
private struct KeywordInfo {
public KeywordInfo( string keyword, string name, string description ) {
Keyword = keyword;
LongName = name;
Description = description;
}
public readonly string Keyword, LongName, Description;
}
private void pFlow_Paint( object sender, PaintEventArgs e ) {
}
}
}