This repository was archived by the owner on Feb 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMainForm.cs
More file actions
148 lines (125 loc) · 5.82 KB
/
MainForm.cs
File metadata and controls
148 lines (125 loc) · 5.82 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
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
using CefSharp;
using ReDevPro.Components;
using System;
using System.IO;
using System.Drawing;
using System.Windows.Forms;
namespace ReDevPro
{
public partial class MainForm : Form
{
public MainForm()
{
Cef.EnableHighDPISupport();
Cef.Initialize(new CefSettings()); //required for cefsharp to work, only needs to be called once
InitializeComponent();
//Add web tabs
WebTab Chat = new WebTab("https://discord.gg/C4P3cp6") { Text = "Chat" };
WebTab News = new WebTab("http://www.ygodevpro.com/category/blog/") { Text = "News" };
WebTab BugTracker = new WebTab("https://ygodevpro.com/forum/forumdisplay.php?fid=16") { Text = "BugTracker" };
IntPtr h = MainTabControl.Handle; //required for insert to work
MainTabControl.TabPages.Insert(0, Chat);
MainTabControl.TabPages.Insert(1, News);
MainTabControl.TabPages.Insert(2, BugTracker);
MainTabControl.SelectedIndex = 0;
//Server Select
Config.AddServer("Butty's Test Server", "81.98.22.127", 8911);
Config.AddServer("LocalHost", "127.0.0.1", 8911);
ServerSelect.Items.AddRange(Config.GetServerList());
ServerSelect.SelectedIndexChanged += UpdateSelectedServer;
ServerSelect.SelectedIndex = 0;
//options
AddOptions();
YGOProOptionsControl.ItemCheck += UpdateOptions;
}
private void AddOptions()
{
YGOProOptionsControl.Items.Add("Auto Placement", Config.GetBool("Auto Placement", true));
YGOProOptionsControl.Items.Add("Auto Chain", Config.GetBool("Auto Chain", true));
YGOProOptionsControl.Items.Add("Random Placement", Config.GetBool("Random Placement", false));
YGOProOptionsControl.Items.Add("No Chain Delay", Config.GetBool("No Chain Delay", false));
YGOProOptionsControl.Items.Add("Mute Opponents", Config.GetBool("Mute Opponents", false));
YGOProOptionsControl.Items.Add("Mute Spectators", Config.GetBool("Mute Spectators", false));
YGOProOptionsControl.Items.Add("Save Last Replay", Config.GetBool("Save Last Replay", true));
YGOProOptionsControl.Items.Add("Mouse Mode", Config.GetBool("Mouse Mode", false));
YGOProOptionsControl.Items.Add("Hide Setnames", Config.GetBool("Hide Setnames", false));
YGOProOptionsControl.Items.Add("Hide Chain Buttons", Config.GetBool("Hide Chain Buttons", false));
YGOProOptionsControl.Items.Add("Old Replay Mode", Config.GetBool("Old Replay Mode", true));
YGOProOptionsControl.Items.Add("Enable Sound", Config.GetBool("Enable Sound", true));
YGOProOptionsControl.Items.Add("Enable Music", Config.GetBool("Enable Music", true));
YGOProOptionsControl.Items.Add("Enable Direct X", Config.GetBool("Enable Direct X", false));
//settings that need to be added
Config.GetString("nickname", "Tester-" + Program.Random.Next(999));
Config.GetInt("sound_volume", 100);
Config.GetInt("music_volume", 100);
Config.GetString("textfont", "fonts/simhei.ttf 12");
Config.GetString("numfont", "fonts/arialbd.ttf");
Config.GetInt("skin_index", 0);
}
private void UpdateOptions(object sender, ItemCheckEventArgs e)
{
Config.UpdateBool(YGOProOptionsControl.SelectedItem.ToString(), e.NewValue == CheckState.Checked);
Config.SaveConfig();
}
private void UpdateSelectedServer(object sender, EventArgs e)
{
if (ServerSelect.SelectedIndex != -1)
{
string selected = ServerSelect.SelectedItem.ToString();
Config.UpdateString("lastip", Config.GetServerIP(selected));
Config.UpdateString("serverport", Config.GetServerPort(selected).ToString());
Config.UpdateString("lastport", Config.GetServerPort(selected).ToString());
}
}
private void DeckEditBtn_Click(object sender, EventArgs e)
{
YGOProHelper.OpenDeckEdit();
}
private void ReplayBtn_Click(object sender, EventArgs e)
{
YGOProHelper.OpenReplays();
}
private void AiBtn_Click(object sender, EventArgs e)
{
YGOProHelper.OpenAI();
}
private void DuelBtn_Click(object sender, EventArgs e)
{
YGOProHelper.OpenDuel();
}
private void PreviewContent_Click(object sender, EventArgs e)
{
if (FileList.SelectedItem != null)
{
//Link to Texture Folder
string basePath = @"";
pictureBox1.ImageLocation = Path.Combine(basePath, FileList.SelectedItem.ToString());
}
}
private void ThemeAdd_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files (*.jpg, *.jpeg, *png)|*.jpg;*.jpeg;*.png";
open.FilterIndex = 1;
DialogResult result = open.ShowDialog();
if (result == DialogResult.OK)
{
//Adds image name to file list
FileList.Items.Add(open.SafeFileName);
pictureBox1.Image = Image.FromFile(open.FileName);
ContentSelect.Items.Add(open.SafeFileName);
//Saving the pic. This path will be saved to the texture folder.
pictureBox1.Image.Save(@"");
FileList.Show();
}
}
public void HideComps()
{
FileList.Hide();
}
private void QuickDuelBtn_Click(object sender, EventArgs e)
{
YGOProHelper.OpenDuel();
}
}
}