First build ported over to LauncherFormShared!

This commit is contained in:
Bitl 2021-03-22 18:27:53 -07:00
parent 2b871ad56c
commit b8813545d3
3 changed files with 164 additions and 103 deletions

View File

@ -1526,6 +1526,59 @@ namespace NovetusLauncher
this.ResumeLayout(false); this.ResumeLayout(false);
} }
private void InitExtendedForm()
{
//*vomits*
launcherForm = new LauncherFormShared();
launcherForm.Parent = this;
launcherForm.FormStyle = Settings.UIOptions.Style.Extended;
launcherForm.ConsoleBox = richTextBox1;
launcherForm.Tabs = tabControl1;
launcherForm.MapDescBox = textBox4;
launcherForm.ServerInfo = textBox3;
launcherForm.Tree = treeView1;
launcherForm._TreeCache = _fieldsTreeCache;
launcherForm.TabPageHost = "tabPage2";
launcherForm.TabPageMaps = "tabPage4";
launcherForm.TabPageClients = "tabPage3";
launcherForm.TabPageSaved = "tabPage6";
launcherForm.ServerBox = listBox3;
launcherForm.PortBox = listBox4;
launcherForm.ClientBox = listBox2;
launcherForm.SplashLabel = label12;
launcherForm.SearchBar = SearchBar;
launcherForm.StyleSelectorBox = comboBox3;
launcherForm.ChangelogBox = richTextBox2;
launcherForm.ReadmeBox = richTextBox3;
launcherForm.ProductVersionLabel = label8;
launcherForm.NovetusVersionLabel = label11;
launcherForm.GraphicsModeBox = comboBox1;
launcherForm.GraphicsLevelBox = comboBox2;
launcherForm.WebServerCheckbox = checkBox8;
launcherForm.CloseOnLaunchCheckbox = checkBox1;
launcherForm.DiscordPresenceCheckbox = checkBox2;
launcherForm.ReShadeCheckbox = checkBox5;
launcherForm.ReShadeFPSDisplayCheckBox = checkBox6;
launcherForm.ReShadePerformanceModeCheckBox = checkBox7;
launcherForm.uPnPCheckBox = checkBox4;
launcherForm.ShowServerNotifsCheckBox = checkBox9;
launcherForm.PlayerIDTextBox = textBox5;
launcherForm.PlayerTripcodeLabel = label18;
launcherForm.RegeneratePlayerIDButton = button4;
launcherForm.PlayerNameTextBox = textBox2;
launcherForm.LocalPlayCheckBox = checkBox3;
launcherForm.IPLabel = label37;
launcherForm.PortLabel = label38;
launcherForm.SelectedClientLabel = label26;
launcherForm.SelectedMapLabel = label28;
launcherForm.PlayerLimitBox = numericUpDown3;
launcherForm.HostPortBox = numericUpDown2;
launcherForm.JoinPortBox = numericUpDown1;
launcherForm.ClientWarningLabel = label30;
launcherForm.ClientDescriptionBox = textBox6;
}
private System.Windows.Forms.CheckBox checkBox4; private System.Windows.Forms.CheckBox checkBox4;
private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button6;
private System.Windows.Forms.TreeView treeView1; private System.Windows.Forms.TreeView treeView1;

View File

@ -24,29 +24,7 @@ namespace NovetusLauncher
{ {
_fieldsTreeCache = new TreeView(); _fieldsTreeCache = new TreeView();
InitializeComponent(); InitializeComponent();
InitExtendedForm();
//*vomits*
launcherForm = new LauncherFormShared();
launcherForm.Parent = this;
launcherForm.FormStyle = Settings.UIOptions.Style.Extended;
launcherForm.ConsoleBox = richTextBox1;
launcherForm.Tabs = tabControl1;
launcherForm.MapDescBox = textBox4;
launcherForm.ServerInfo = textBox3;
launcherForm.Tree = treeView1;
launcherForm._TreeCache = _fieldsTreeCache;
launcherForm.TabPageHost = "tabPage2";
launcherForm.TabPageMaps = "tabPage4";
launcherForm.TabPageClients = "tabPage3";
launcherForm.TabPageSaved = "tabPage6";
launcherForm.ServerBox = listBox3;
launcherForm.PortBox = listBox4;
launcherForm.ClientBox = listBox2;
launcherForm.SplashLabel = label12;
launcherForm.SearchBar = SearchBar;
launcherForm.StyleSelectorBox = comboBox3;
launcherForm.ChangelogBox = richTextBox2;
launcherForm.ReadmeBox = richTextBox3;
Size = new Size(745, 377); Size = new Size(745, 377);
panel2.Size = new Size(646, 272); panel2.Size = new Size(646, 272);
@ -116,12 +94,12 @@ namespace NovetusLauncher
{ {
launcherForm.GeneratePlayerID(); launcherForm.GeneratePlayerID();
} }
void Button5Click(object sender, EventArgs e) void Button5Click(object sender, EventArgs e)
{ {
launcherForm.WriteConfigValues(true); launcherForm.WriteConfigValues(true);
} }
void TextBox2TextChanged(object sender, EventArgs e) void TextBox2TextChanged(object sender, EventArgs e)
{ {
GlobalVars.UserConfiguration.PlayerName = textBox2.Text; GlobalVars.UserConfiguration.PlayerName = textBox2.Text;

View File

@ -27,11 +27,16 @@ namespace NovetusLauncher
public Settings.UIOptions.Style FormStyle = Settings.UIOptions.Style.None; public Settings.UIOptions.Style FormStyle = Settings.UIOptions.Style.None;
public RichTextBox ConsoleBox, ChangelogBox, ReadmeBox = null; public RichTextBox ConsoleBox, ChangelogBox, ReadmeBox = null;
public TabControl Tabs = null; public TabControl Tabs = null;
public TextBox MapDescBox, ServerInfo, SearchBar = null; public TextBox MapDescBox, ServerInfo, SearchBar, PlayerIDTextBox, PlayerNameTextBox, ClientDescriptionBox = null;
public TreeView Tree, _TreeCache = null; public TreeView Tree, _TreeCache = null;
public ListBox ServerBox, PortBox, ClientBox = null; public ListBox ServerBox, PortBox, ClientBox = null;
public Label SplashLabel = null; public Label SplashLabel, ProductVersionLabel, NovetusVersionLabel, PlayerTripcodeLabel, IPLabel, PortLabel,
public ComboBox StyleSelectorBox = null; SelectedClientLabel, SelectedMapLabel, ClientWarningLabel = null;
public ComboBox StyleSelectorBox, GraphicsModeBox, GraphicsLevelBox = null;
public CheckBox WebServerCheckbox, CloseOnLaunchCheckbox, DiscordPresenceCheckbox, ReShadeCheckbox, ReShadeFPSDisplayCheckBox,
ReShadePerformanceModeCheckBox, uPnPCheckBox, ShowServerNotifsCheckBox, LocalPlayCheckBox = null;
public Button RegeneratePlayerIDButton = null;
public NumericUpDown PlayerLimitBox, HostPortBox, JoinPortBox = null;
public string TabPageHost, TabPageMaps, TabPageClients, TabPageSaved = ""; public string TabPageHost, TabPageMaps, TabPageClients, TabPageSaved = "";
#endregion #endregion
@ -219,7 +224,6 @@ namespace NovetusLauncher
#endregion #endregion
#region Form Event Functions #region Form Event Functions
public void InitForm() public void InitForm()
{ {
Parent.Text = "Novetus " + GlobalVars.ProgramInformation.Version; Parent.Text = "Novetus " + GlobalVars.ProgramInformation.Version;
@ -267,9 +271,9 @@ namespace NovetusLauncher
GlobalFuncs.CreateAssetCacheDirectories(); GlobalFuncs.CreateAssetCacheDirectories();
label8.Text = Application.ProductVersion; ProductVersionLabel.Text = Application.ProductVersion;
LocalVars.important = SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location); LocalVars.important = SecurityFuncs.GenerateMD5(Assembly.GetExecutingAssembly().Location);
label11.Text = GlobalVars.ProgramInformation.Version; NovetusVersionLabel.Text = GlobalVars.ProgramInformation.Version;
SplashLabel.Text = SplashReader.GetSplash(); SplashLabel.Text = SplashReader.GetSplash();
LocalVars.prevsplash = SplashLabel.Text; LocalVars.prevsplash = SplashLabel.Text;
@ -408,9 +412,29 @@ namespace NovetusLauncher
{ {
if (gameType == ScriptType.Studio) if (gameType == ScriptType.Studio)
{ {
DialogResult result = MessageBox.Show("If you want to test out your place, you will have to save your place in Novetus's map folder, then launch your place in Play Solo.", "Novetus - Launch ROBLOX Studio", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (FormStyle == Settings.UIOptions.Style.Extended)
if (result == DialogResult.Cancel) {
return; DialogResult result = MessageBox.Show("If you want to test out your place, you will have to save your place in Novetus's map folder, then launch your place in Play Solo.", "Novetus - Launch ROBLOX Studio", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (result == DialogResult.Cancel)
return;
}
else
{
DialogResult result = MessageBox.Show("If you want to test out your place, you will have to save your place in Novetus's map folder, then launch your place in Play Solo." + Environment.NewLine + Environment.NewLine + "Press Yes to launch Studio with a map, or No to launch Studio without a map.", "Novetus - Launch ROBLOX Studio", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
bool nomapLegacy = false;
switch (result)
{
case DialogResult.Cancel:
return;
case DialogResult.No:
nomapLegacy = true;
nomap = nomapLegacy;
break;
default:
break;
}
}
} }
if (gameType == ScriptType.Client && GlobalVars.LocalPlayMode) if (gameType == ScriptType.Client && GlobalVars.LocalPlayMode)
@ -729,74 +753,80 @@ namespace NovetusLauncher
{ {
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false); GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, false);
checkBox1.Checked = GlobalVars.UserConfiguration.CloseOnLaunch; CloseOnLaunchCheckbox.Checked = GlobalVars.UserConfiguration.CloseOnLaunch;
textBox5.Text = GlobalVars.UserConfiguration.UserID.ToString(); PlayerIDTextBox.Text = GlobalVars.UserConfiguration.UserID.ToString();
label18.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString(); PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString();
numericUpDown3.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.PlayerLimit); PlayerLimitBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.PlayerLimit);
textBox2.Text = GlobalVars.UserConfiguration.PlayerName; PlayerNameTextBox.Text = GlobalVars.UserConfiguration.PlayerName;
label26.Text = GlobalVars.UserConfiguration.SelectedClient; SelectedClientLabel.Text = GlobalVars.UserConfiguration.SelectedClient;
label28.Text = GlobalVars.UserConfiguration.Map; SelectedMapLabel.Text = GlobalVars.UserConfiguration.Map;
treeView1.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, Tree.Nodes); Tree.SelectedNode = TreeNodeHelper.SearchTreeView(GlobalVars.UserConfiguration.Map, Tree.Nodes);
treeView1.Focus(); Tree.Focus();
numericUpDown1.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); JoinPortBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort);
numericUpDown2.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); HostPortBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort);
label37.Text = GlobalVars.IP; IPLabel.Text = GlobalVars.IP;
label38.Text = GlobalVars.UserConfiguration.RobloxPort.ToString(); PortLabel.Text = GlobalVars.UserConfiguration.RobloxPort.ToString();
checkBox2.Checked = GlobalVars.UserConfiguration.DiscordPresence; DiscordPresenceCheckbox.Checked = GlobalVars.UserConfiguration.DiscordPresence;
checkBox5.Checked = GlobalVars.UserConfiguration.ReShade; ReShadeCheckbox.Checked = GlobalVars.UserConfiguration.ReShade;
checkBox6.Checked = GlobalVars.UserConfiguration.ReShadeFPSDisplay; ReShadeFPSDisplayCheckBox.Checked = GlobalVars.UserConfiguration.ReShadeFPSDisplay;
checkBox7.Checked = GlobalVars.UserConfiguration.ReShadePerformanceMode; ReShadePerformanceModeCheckBox.Checked = GlobalVars.UserConfiguration.ReShadePerformanceMode;
checkBox4.Checked = GlobalVars.UserConfiguration.UPnP; uPnPCheckBox.Checked = GlobalVars.UserConfiguration.UPnP;
checkBox9.Checked = GlobalVars.UserConfiguration.ShowServerNotifications; ShowServerNotifsCheckBox.Checked = GlobalVars.UserConfiguration.ShowServerNotifications;
if (SecurityFuncs.IsElevated) if (SecurityFuncs.IsElevated)
{ {
checkBox8.Enabled = true; WebServerCheckbox.Enabled = true;
checkBox8.Checked = GlobalVars.UserConfiguration.WebServer; WebServerCheckbox.Checked = GlobalVars.UserConfiguration.WebServer;
} }
else else
{ {
checkBox8.Enabled = false; WebServerCheckbox.Enabled = false;
} }
if (FormStyle == Settings.UIOptions.Style.Extended) if (FormStyle == Settings.UIOptions.Style.Extended)
{ {
switch (GlobalVars.UserConfiguration.GraphicsMode) if (GraphicsModeBox != null)
{ {
case Settings.GraphicsOptions.Mode.OpenGL: switch (GlobalVars.UserConfiguration.GraphicsMode)
comboBox1.SelectedIndex = 1; {
break; case Settings.GraphicsOptions.Mode.OpenGL:
case Settings.GraphicsOptions.Mode.DirectX: GraphicsModeBox.SelectedIndex = 1;
comboBox1.SelectedIndex = 2; break;
break; case Settings.GraphicsOptions.Mode.DirectX:
default: GraphicsModeBox.SelectedIndex = 2;
comboBox1.SelectedIndex = 0; break;
break; default:
GraphicsModeBox.SelectedIndex = 0;
break;
}
} }
switch (GlobalVars.UserConfiguration.QualityLevel) if (GraphicsLevelBox != null)
{ {
case Settings.GraphicsOptions.Level.VeryLow: switch (GlobalVars.UserConfiguration.QualityLevel)
comboBox2.SelectedIndex = 1; {
break; case Settings.GraphicsOptions.Level.VeryLow:
case Settings.GraphicsOptions.Level.Low: GraphicsLevelBox.SelectedIndex = 1;
comboBox2.SelectedIndex = 2; break;
break; case Settings.GraphicsOptions.Level.Low:
case Settings.GraphicsOptions.Level.Medium: GraphicsLevelBox.SelectedIndex = 2;
comboBox2.SelectedIndex = 3; break;
break; case Settings.GraphicsOptions.Level.Medium:
case Settings.GraphicsOptions.Level.High: GraphicsLevelBox.SelectedIndex = 3;
comboBox2.SelectedIndex = 4; break;
break; case Settings.GraphicsOptions.Level.High:
case Settings.GraphicsOptions.Level.Ultra: GraphicsLevelBox.SelectedIndex = 4;
comboBox2.SelectedIndex = 5; break;
break; case Settings.GraphicsOptions.Level.Ultra:
case Settings.GraphicsOptions.Level.Custom: GraphicsLevelBox.SelectedIndex = 5;
comboBox2.SelectedIndex = 6; break;
break; case Settings.GraphicsOptions.Level.Custom:
default: GraphicsLevelBox.SelectedIndex = 6;
comboBox2.SelectedIndex = 0; break;
break; default:
GraphicsLevelBox.SelectedIndex = 0;
break;
}
} }
} }
@ -858,55 +888,55 @@ namespace NovetusLauncher
switch (GlobalVars.SelectedClientInfo.UsesPlayerName) switch (GlobalVars.SelectedClientInfo.UsesPlayerName)
{ {
case true: case true:
textBox2.Enabled = true; PlayerNameTextBox.Enabled = true;
break; break;
case false: case false:
textBox2.Enabled = false; PlayerNameTextBox.Enabled = false;
break; break;
} }
switch (GlobalVars.SelectedClientInfo.UsesID) switch (GlobalVars.SelectedClientInfo.UsesID)
{ {
case true: case true:
textBox5.Enabled = true; PlayerIDTextBox.Enabled = true;
button4.Enabled = true; RegeneratePlayerIDButton.Enabled = true;
if (GlobalVars.IP.Equals("localhost")) if (GlobalVars.IP.Equals("localhost"))
{ {
checkBox3.Enabled = true; LocalPlayCheckBox.Enabled = true;
} }
break; break;
case false: case false:
textBox5.Enabled = false; PlayerIDTextBox.Enabled = false;
button4.Enabled = false; RegeneratePlayerIDButton.Enabled = false;
checkBox3.Enabled = false; LocalPlayCheckBox.Enabled = false;
GlobalVars.LocalPlayMode = false; GlobalVars.LocalPlayMode = false;
break; break;
} }
if (!string.IsNullOrWhiteSpace(GlobalVars.SelectedClientInfo.Warning)) if (!string.IsNullOrWhiteSpace(GlobalVars.SelectedClientInfo.Warning))
{ {
label30.Text = GlobalVars.SelectedClientInfo.Warning; ClientWarningLabel.Text = GlobalVars.SelectedClientInfo.Warning;
label30.Visible = true; ClientWarningLabel.Visible = true;
} }
else else
{ {
label30.Visible = false; ClientWarningLabel.Visible = false;
} }
textBox6.Text = GlobalVars.SelectedClientInfo.Description; ClientDescriptionBox.Text = GlobalVars.SelectedClientInfo.Description;
label26.Text = GlobalVars.UserConfiguration.SelectedClient; SelectedClientLabel.Text = GlobalVars.UserConfiguration.SelectedClient;
} }
public void GeneratePlayerID() public void GeneratePlayerID()
{ {
GlobalFuncs.GeneratePlayerID(); GlobalFuncs.GeneratePlayerID();
textBox5.Text = Convert.ToString(GlobalVars.UserConfiguration.UserID); PlayerIDTextBox.Text = Convert.ToString(GlobalVars.UserConfiguration.UserID);
} }
public void GenerateTripcode() public void GenerateTripcode()
{ {
GlobalFuncs.GenerateTripcode(); GlobalFuncs.GenerateTripcode();
label18.Text = GlobalVars.UserConfiguration.PlayerTripcode; PlayerTripcodeLabel.Text = GlobalVars.UserConfiguration.PlayerTripcode;
} }
#endregion #endregion