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.
266 lines
8.7 KiB
266 lines
8.7 KiB
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 class calc
|
|
{
|
|
public static int e = 0;
|
|
}
|
|
|
|
private void btn_reset_Click(object sender, EventArgs e)
|
|
{
|
|
global.eng = 4;
|
|
global.sys = 4;
|
|
global.wep = 4;
|
|
update();
|
|
}
|
|
public void update()
|
|
{
|
|
prog_eng.Value = global.eng;
|
|
prog_sys.Value = global.sys;
|
|
prog_wep.Value = global.wep;
|
|
}
|
|
|
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
|
{
|
|
//capture up arrow key
|
|
if (keyData == Keys.Up)
|
|
{
|
|
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 (!fin)
|
|
{
|
|
MessageBox.Show("Internal math error!");
|
|
}
|
|
}*/
|
|
}
|
|
else
|
|
{
|
|
if (global.sys >= 1 && !fin)
|
|
{
|
|
global.eng += 1;
|
|
global.sys -= 1;
|
|
fin = true;
|
|
}
|
|
/*else
|
|
{
|
|
if (!fin)
|
|
{
|
|
MessageBox.Show("Internal math error!");
|
|
}
|
|
}*/
|
|
}
|
|
}
|
|
|
|
}
|
|
update();
|
|
return true;
|
|
}
|
|
//capture down arrow key
|
|
if (keyData == Keys.Down)
|
|
{
|
|
global.eng = 4;
|
|
global.sys = 4;
|
|
global.wep = 4;
|
|
update();
|
|
return true;
|
|
}
|
|
//capture left arrow key
|
|
if (keyData == Keys.Left)
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
update();
|
|
return true;
|
|
}
|
|
//capture right arrow key
|
|
if (keyData == Keys.Right)
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
update();
|
|
return true;
|
|
}
|
|
return base.ProcessCmdKey(ref msg, keyData);
|
|
}
|
|
|
|
private void lbl_copyright_Click(object sender, EventArgs e)
|
|
{
|
|
lbl_xant_ad.Visible = true;
|
|
}
|
|
}
|
|
}
|