Make windows optional

pull/9/head
Miepee 4 years ago
parent 0f04acd124
commit 3bc4fed0ab

@ -45,6 +45,8 @@ public partial class ModPacker : Form
var miscOptionsPanel = new DynamicLayout() { Spacing = new Size(5, 5) };
miscOptionsPanel.AddRow(musicCheckBox);
miscOptionsPanel.AddRow(yycCheckBox);
miscOptionsPanel.AddRow(windowsCheckBox);
miscOptionsPanel.AddRow(windowsButton, windowsLabel);
miscOptionsPanel.AddRow(apkCheckBox);
miscOptionsPanel.AddRow(apkButton, apkLabel);
miscOptionsPanel.AddRow(linuxCheckBox);
@ -53,8 +55,7 @@ public partial class ModPacker : Form
miscOptionsPanel.AddRow(macButton, macLabel);
var loadZipsPanel = new DynamicLayout() { Spacing = new Size(5, 5) };
loadZipsPanel.AddRow(originalZipButton, null, modZipButton);
loadZipsPanel.AddRow(originalZipLabel, null, modZipLabel);
loadZipsPanel.AddRow(originalZipButton, null, originalZipLabel);
var resultPanel = new DynamicLayout() { Spacing = new Size(5, 5) };
resultPanel.AddRow(createButton);
@ -81,8 +82,9 @@ public partial class ModPacker : Form
// Assign events
originalZipButton.Click += OriginalZipButton_Click;
modZipButton.Click += ModZipButton_Click;
createButton.Click += CreateButton_Click;
windowsCheckBox.CheckedChanged += WindowsCheckBox_CheckedChanged;
windowsButton.Click += WindowsButton_Click;
apkButton.Click += ApkButton_Click;
apkCheckBox.CheckedChanged += ApkCheckBoxCheckedChanged;
customSaveCheckBox.CheckedChanged += CustomSaveCheckBoxChecked_Changed;
@ -111,6 +113,10 @@ public partial class ModPacker : Form
private CheckBox yycCheckBox = new CheckBox() { Text = "Uses the YoYo Compiler" };
private CheckBox windowsCheckBox = new CheckBox() { Text = "Supports Windows" };
private Button windowsButton = new Button() { Text = "Load modded Windows .zip", Enabled = false };
private Label windowsLabel = new Label() { Text = "Modded Windows game loaded!", Visible = false };
private CheckBox apkCheckBox = new CheckBox() { Text = "Supports Android" };
private Button apkButton = new Button() { Text = "Load modded Android APK", Enabled = false };
private Label apkLabel = new Label() { Text = "Modded APK loaded!", Visible = false };
@ -125,8 +131,6 @@ public partial class ModPacker : Form
private Button originalZipButton = new Button() { Text = "Load 1.1" };
private Label originalZipLabel = new Label() { Text = "1.1 loaded!", Visible = false};
private Button modZipButton = new Button() { Text = "Load modded game" };
private Label modZipLabel = new Label() { Text = "Mod loaded!", Visible = false };
private Button createButton = new Button() { Text = "Create mod package(s)", Enabled = false };
private Label createLabel = new Label() { Text = "Mod package created!", Visible = false};
#endregion

@ -13,8 +13,8 @@ namespace AM2RModPacker;
public partial class ModPacker : Form
{
private static readonly string version = Core.Version;
private bool isOriginalLoaded, isModLoaded, isApkLoaded, isLinuxLoaded, isMacLoaded;
private string originalPath, modPath, apkPath, linuxPath, macPath;
private bool isOriginalLoaded, isWindowsLoaded, isApkLoaded, isLinuxLoaded, isMacLoaded;
private string originalPath, windowsPath, apkPath, linuxPath, macPath;
private string saveFilePath;
private readonly ModProfileXML profile;
@ -84,6 +84,20 @@ public partial class ModPacker : Form
macPath = "";
}
private void WindowsCheckBox_CheckedChanged(object sender, EventArgs e)
{
windowsButton.Enabled = windowsCheckBox.Checked.Value;
UpdateCreateButton();
}
private void WindowsButton_Click(object sender, EventArgs e)
{
// Open window to select modded Linux .zip
(isWindowsLoaded, windowsPath) = SelectFile("Please select your custom Windows AM2R .zip", zipFileFilter);
windowsLabel.Visible = isWindowsLoaded;
UpdateCreateButton();
}
private void ApkCheckBoxCheckedChanged(object sender, EventArgs e)
{
apkButton.Enabled = apkCheckBox.Checked.Value;
@ -142,14 +156,6 @@ public partial class ModPacker : Form
UpdateCreateButton();
}
private void ModZipButton_Click(object sender, EventArgs e)
{
// Open window to select modded AM2R
(isModLoaded, modPath) = SelectFile("Please select your custom AM2R .zip", zipFileFilter);
modZipLabel.Visible = isModLoaded;
UpdateCreateButton();
}
private void CreateButton_Click(object sender, EventArgs e)
{
if (nameTextBox.Text == "" || authorTextBox.Text == "" || versionTextBox.Text == "")
@ -182,7 +188,7 @@ public partial class ModPacker : Form
}
LoadProfileParameters(ProfileOperatingSystems.Windows);
(bool successful, string errorcode) = Core.CreateModPack(profile, modPath,originalPath, apkPath, output);
(bool successful, string errorcode) = Core.CreateModPack(profile, windowsPath,originalPath, apkPath, output);
if (!successful)
{
MessageBox.Show(errorcode, "Error", MessageBoxButtons.OK, MessageBoxType.Error);
@ -256,11 +262,11 @@ public partial class ModPacker : Form
{
// Unload files
isOriginalLoaded = false;
isModLoaded = false;
isWindowsLoaded = false;
isApkLoaded = false;
isLinuxLoaded = false;
originalPath = "";
modPath = "";
windowsPath = "";
apkPath = "";
linuxPath = "";
saveFilePath = null;
@ -268,7 +274,6 @@ public partial class ModPacker : Form
// Set labels
createLabel.Text = "Mod packaging aborted!";
originalZipLabel.Visible = false;
modZipLabel.Visible = false;
apkLabel.Visible = false;
linuxLabel.Visible = false;
@ -280,10 +285,11 @@ public partial class ModPacker : Form
private void UpdateCreateButton()
{
if (isOriginalLoaded && // AM2R_11 zip must be provided
isModLoaded && // Modded zip must be provided
(!windowsCheckBox.Checked.Value || isWindowsLoaded) && // either Windows is disabled OR windows is provided
(!apkCheckBox.Checked.Value || isApkLoaded) && // either APK is disabled OR APK is provided
(!linuxCheckBox.Checked.Value || isLinuxLoaded) && // either Linux is disabled OR linux is provided
(!macCheckBox.Checked.Value || isMacLoaded) && // either Mac is disabled OR mac is provided
(isWindowsLoaded || isLinuxLoaded || isMacLoaded) && // one desktop OS has to be selected
(!customSaveCheckBox.Checked.Value || customSaveTextBox.Text != "")) // either custom saves are disabled OR custom save is provided
createButton.Enabled = true;
else

Loading…
Cancel
Save