You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
384 lines
12 KiB
384 lines
12 KiB
using elite_power_sim;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Elite_Power_Management_Simulator
|
|
{
|
|
public partial class form_main : Form
|
|
{
|
|
public form_main()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public static class global
|
|
{
|
|
public static Int16 eng = 4;
|
|
public static Int16 sys = 4;
|
|
public static Int16 wep = 4;
|
|
|
|
public static string key_rst = "KBDOWN ";
|
|
public static string key_sys = "KBLEFT ";
|
|
public static string key_eng = "KBUP ";
|
|
public static string key_wep = "KBRIGHT ";
|
|
|
|
public static string rst_text = "[ RST ]\t\t[ 2 / 2 / 2 ]";
|
|
|
|
public static int log_count = 0;
|
|
}
|
|
|
|
public static class calc
|
|
{
|
|
public static int e = 0;
|
|
}
|
|
|
|
private void btn_reset_Click(object sender, EventArgs e)
|
|
{
|
|
pwr_reset();
|
|
}
|
|
public void update()
|
|
{
|
|
prog_eng.Value = global.eng;
|
|
prog_sys.Value = global.sys;
|
|
prog_wep.Value = global.wep;
|
|
|
|
//Update Labels to show pip count
|
|
string eng = Convert.ToString(Convert.ToDecimal(global.eng) / 2);
|
|
string sys = Convert.ToString(Convert.ToDecimal(global.sys) / 2);
|
|
string wep = Convert.ToString(Convert.ToDecimal(global.wep) / 2);
|
|
lbl_eng.Text = "ENG\n" + eng;
|
|
lbl_sys.Text = "SYS\n" + sys;
|
|
lbl_wep.Text = "WEP\n" + wep;
|
|
}
|
|
|
|
//Distribution History Tracking
|
|
public void track_history(string log_item, string log_btn)
|
|
{
|
|
string q = log_item;
|
|
string eng = Convert.ToString(Convert.ToDecimal(global.eng)/2);
|
|
string sys = Convert.ToString(Convert.ToDecimal(global.sys)/2);
|
|
string wep = Convert.ToString(Convert.ToDecimal(global.wep)/2);
|
|
global.log_count += 1; //Increment log count before declaring log entry number 'lc'
|
|
string lc = Convert.ToString(global.log_count);
|
|
|
|
lst_log.Items.Add(q + "\t\t" + "[ " + sys + " / " + eng + " / " + wep + " ]\t\t" + lc);
|
|
txt_mba.Text = txt_mba.Text + log_btn;
|
|
}
|
|
public void reset_history()
|
|
{
|
|
lst_log.Items.Clear();
|
|
lst_log.Items.Add(global.rst_text);
|
|
txt_mba.Text = global.key_rst;
|
|
lbl_mbaChangeWarning.Hide();
|
|
}
|
|
|
|
//Power Distribution Functions
|
|
public void pwr_reset()
|
|
{
|
|
global.eng = 4;
|
|
global.sys = 4;
|
|
global.wep = 4;
|
|
global.log_count = 0;
|
|
reset_history();
|
|
update();
|
|
}
|
|
public void pwr_eng()
|
|
{
|
|
string log_iname = "+ENG";
|
|
bool fin = false;
|
|
if (global.eng < 8)
|
|
{
|
|
if (global.eng == 7)
|
|
{
|
|
calc.e = 1;
|
|
}
|
|
else
|
|
{
|
|
calc.e = 2;
|
|
}
|
|
if (calc.e == 2)
|
|
{
|
|
if (global.sys >= 1 && global.wep >= 1 && !fin)
|
|
{
|
|
global.eng += 2;
|
|
global.sys -= 1;
|
|
global.wep -= 1;
|
|
fin = true;
|
|
}
|
|
if (global.sys < 1 && global.wep > 1 && !fin)
|
|
{
|
|
global.eng += 2;
|
|
global.wep -= 2;
|
|
fin = true;
|
|
}
|
|
if (global.sys > 1 && global.wep < 1 && !fin)
|
|
{
|
|
global.eng += 2;
|
|
global.sys -= 2;
|
|
fin = true;
|
|
}
|
|
}
|
|
if (calc.e == 1)
|
|
{
|
|
if (global.sys % 2 == 0)
|
|
{
|
|
if (global.wep >= 1 && !fin)
|
|
{
|
|
global.eng += 1;
|
|
global.wep -= 1;
|
|
fin = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (global.sys >= 1 && !fin)
|
|
{
|
|
global.eng += 1;
|
|
global.sys -= 1;
|
|
fin = true;
|
|
}
|
|
}
|
|
}
|
|
track_history(log_iname, global.key_eng);
|
|
}
|
|
update();
|
|
}
|
|
public void pwr_sys()
|
|
{
|
|
string log_iname = "+SYS";
|
|
bool fin = false;
|
|
if (global.sys < 8)
|
|
{
|
|
if (global.sys == 7)
|
|
{
|
|
calc.e = 1;
|
|
}
|
|
else
|
|
{
|
|
calc.e = 2;
|
|
}
|
|
if (calc.e == 2)
|
|
{
|
|
if (global.eng >= 1 && global.wep >= 1 && !fin)
|
|
{
|
|
global.sys += 2;
|
|
global.eng -= 1;
|
|
global.wep -= 1;
|
|
fin = true;
|
|
}
|
|
if (global.eng < 1 && global.wep > 1 && !fin)
|
|
{
|
|
global.sys += 2;
|
|
global.wep -= 2;
|
|
fin = true;
|
|
}
|
|
if (global.eng > 1 && global.wep < 1 && !fin)
|
|
{
|
|
global.sys += 2;
|
|
global.eng -= 2;
|
|
fin = true;
|
|
}
|
|
}
|
|
if (calc.e == 1)
|
|
{
|
|
if (global.eng % 2 == 0)
|
|
{
|
|
if (global.wep >= 1 && !fin)
|
|
{
|
|
global.sys += 1;
|
|
global.wep -= 1;
|
|
fin = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (global.eng >= 1 && !fin)
|
|
{
|
|
global.sys += 1;
|
|
global.eng -= 1;
|
|
fin = true;
|
|
}
|
|
}
|
|
}
|
|
track_history(log_iname, global.key_sys);
|
|
}
|
|
update();
|
|
}
|
|
public void pwr_wep()
|
|
{
|
|
string log_iname = "+WEP";
|
|
bool fin = false;
|
|
if (global.wep < 8)
|
|
{
|
|
if (global.wep == 7)
|
|
{
|
|
calc.e = 1;
|
|
}
|
|
else
|
|
{
|
|
calc.e = 2;
|
|
}
|
|
if (calc.e == 2)
|
|
{
|
|
if (global.sys >= 1 && global.eng >= 1 && !fin)
|
|
{
|
|
global.wep += 2;
|
|
global.sys -= 1;
|
|
global.eng -= 1;
|
|
fin = true;
|
|
}
|
|
if (global.sys < 1 && global.eng > 1 && !fin)
|
|
{
|
|
global.wep += 2;
|
|
global.eng -= 2;
|
|
fin = true;
|
|
}
|
|
if (global.sys > 1 && global.eng < 1 && !fin)
|
|
{
|
|
global.wep += 2;
|
|
global.sys -= 2;
|
|
fin = true;
|
|
}
|
|
}
|
|
if (calc.e == 1)
|
|
{
|
|
if (global.sys % 2 == 0)
|
|
{
|
|
if (global.eng >= 1 && !fin)
|
|
{
|
|
global.wep += 1;
|
|
global.eng -= 1;
|
|
fin = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (global.sys >= 1 && !fin)
|
|
{
|
|
global.wep += 1;
|
|
global.sys -= 1;
|
|
fin = true;
|
|
}
|
|
}
|
|
}
|
|
track_history(log_iname, global.key_wep);
|
|
}
|
|
update();
|
|
}
|
|
|
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
|
{
|
|
if (keyData == Keys.Up)
|
|
{
|
|
pwr_eng();
|
|
return true;
|
|
}
|
|
if (keyData == Keys.Down)
|
|
{
|
|
pwr_reset();
|
|
return true;
|
|
}
|
|
if (keyData == Keys.Left)
|
|
{
|
|
pwr_sys();
|
|
return true;
|
|
}
|
|
if (keyData == Keys.Right)
|
|
{
|
|
pwr_wep();
|
|
return true;
|
|
}
|
|
return base.ProcessCmdKey(ref msg, keyData);
|
|
}
|
|
|
|
private void lbl_copyright_Click(object sender, EventArgs e)
|
|
{
|
|
lbl_xant_ad.Visible = true;
|
|
}
|
|
|
|
private void cbox_showLog_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
//Default size: 408, 248
|
|
if (!cbox_showLog.Checked)
|
|
{
|
|
this.Width = 408;
|
|
this.Height = 248;
|
|
gbox_log.Hide();
|
|
gbox_macroBuilder.Hide();
|
|
}
|
|
else
|
|
{
|
|
this.Width = 800;
|
|
this.Height = 363;
|
|
gbox_log.Show();
|
|
gbox_macroBuilder.Show();
|
|
}
|
|
}
|
|
|
|
private void txt_custSys_TextChanged(object sender, EventArgs e)
|
|
{
|
|
global.key_sys = txt_custSys.Text;
|
|
lbl_mbaChangeWarning.Show();
|
|
}
|
|
|
|
private void txt_custEng_TextChanged(object sender, EventArgs e)
|
|
{
|
|
global.key_eng = txt_custEng.Text;
|
|
lbl_mbaChangeWarning.Show();
|
|
}
|
|
|
|
private void txt_custWep_TextChanged(object sender, EventArgs e)
|
|
{
|
|
global.key_wep = txt_custWep.Text;
|
|
lbl_mbaChangeWarning.Show();
|
|
}
|
|
|
|
private void txt_custRst_TextChanged(object sender, EventArgs e)
|
|
{
|
|
global.key_rst = txt_custRst.Text;
|
|
lbl_mbaChangeWarning.Show();
|
|
}
|
|
|
|
private void rad_mba_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (rad_ch.Checked)
|
|
{
|
|
global.key_rst = "KBDOWN ";
|
|
global.key_sys = "KBLEFT ";
|
|
global.key_eng = "KBUP ";
|
|
global.key_wep = "KBRIGHT ";
|
|
|
|
lbl_mbaChangeWarning.Show();
|
|
gbox_custom.Hide();
|
|
}
|
|
if (rad_ahk.Checked)
|
|
{
|
|
global.key_rst = "{down}";
|
|
global.key_sys = "{left}";
|
|
global.key_eng = "{up}";
|
|
global.key_wep = "{right}";
|
|
|
|
lbl_mbaChangeWarning.Show();
|
|
gbox_custom.Hide();
|
|
}
|
|
if (rad_custom.Checked)
|
|
{
|
|
global.key_rst = txt_custRst.Text;
|
|
global.key_sys = txt_custSys.Text;
|
|
global.key_eng = txt_custEng.Text;
|
|
global.key_wep = txt_custWep.Text;
|
|
|
|
lbl_mbaChangeWarning.Show();
|
|
gbox_custom.Show();
|
|
}
|
|
}
|
|
}
|
|
}
|