Modularized power distribution functions

master
Aaron Johnson 5 years ago
parent 68a8155ed7
commit 74c238b472

@ -31,10 +31,7 @@ namespace Elite_Power_Management_Simulator
private void btn_reset_Click(object sender, EventArgs e) private void btn_reset_Click(object sender, EventArgs e)
{ {
global.eng = 4; pwr_reset();
global.sys = 4;
global.wep = 4;
update();
} }
public void update() public void update()
{ {
@ -43,10 +40,15 @@ namespace Elite_Power_Management_Simulator
prog_wep.Value = global.wep; prog_wep.Value = global.wep;
} }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) //Power Distribution Functions
public void pwr_reset()
{ {
//capture up arrow key global.eng = 4;
if (keyData == Keys.Up) global.sys = 4;
global.wep = 4;
update();
}
public void pwr_eng()
{ {
bool fin = false; bool fin = false;
if (global.eng < 8) if (global.eng < 8)
@ -119,19 +121,8 @@ namespace Elite_Power_Management_Simulator
} }
update(); update();
return true;
} }
//capture down arrow key public void pwr_sys()
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; bool fin = false;
if (global.sys < 8) if (global.sys < 8)
@ -190,10 +181,8 @@ namespace Elite_Power_Management_Simulator
} }
update(); update();
return true;
} }
//capture right arrow key public void pwr_wep()
if (keyData == Keys.Right)
{ {
bool fin = false; bool fin = false;
if (global.wep < 8) if (global.wep < 8)
@ -252,6 +241,28 @@ namespace Elite_Power_Management_Simulator
} }
update(); 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 true;
} }
return base.ProcessCmdKey(ref msg, keyData); return base.ProcessCmdKey(ref msg, keyData);

Loading…
Cancel
Save