remove IsControl that I committed earlier, decided not to do it that way

This commit is contained in:
adelikat 2013-12-13 22:26:52 +00:00
parent 483cf96853
commit 458d6951c0
2 changed files with 14 additions and 43 deletions

View File

@ -528,32 +528,11 @@ namespace BizHawk.Client.Common
sb.Append('|'); sb.Append('|');
foreach (var mc in collections) foreach (var mc in collections)
{ {
if (mc.IsControl) foreach (var kvp in mc)
{ {
bool anyPressed = false; if (buttons.ContainsKey(kvp.Key))
foreach (var kvp in mc)
{ {
if (buttons.ContainsKey(kvp.Key) && buttons[kvp.Key]) sb.Append(buttons[kvp.Key] ? kvp.Value : '.');
{
sb.Append(kvp.Value);
anyPressed = true;
break;
}
}
if (!anyPressed)
{
sb.Append('.');
}
}
else
{
foreach (var kvp in mc)
{
if (buttons.ContainsKey(kvp.Key))
{
sb.Append(buttons[kvp.Key] ? kvp.Value : '.');
}
} }
} }

View File

@ -9,20 +9,12 @@ namespace BizHawk.Client.Common
{ {
private readonly string _name = String.Empty; private readonly string _name = String.Empty;
public MnemonicCollection(string name, bool isControl) public MnemonicCollection(string name)
{ {
_name = name; _name = name;
IsControl = isControl;
} }
public string Name { get { return _name; } } public string Name { get { return _name; } }
/// <summary>
/// Flag to indicate that the mnemonic string is for control types (power, reset, disc swaping, etc)
/// Control types can only have one active control pressed at a time
/// Priority will be based on the enumerated order, so the dictionary should be made accordingly
/// </summary>
public bool IsControl { get; private set; }
} }
public class CoreMnemonicCollection : List<MnemonicCollection> public class CoreMnemonicCollection : List<MnemonicCollection>
@ -74,7 +66,7 @@ namespace BizHawk.Client.Common
{ {
new CoreMnemonicCollection(new []{ "NES", "FDS" }) new CoreMnemonicCollection(new []{ "NES", "FDS" })
{ {
new MnemonicCollection("Console", true) new MnemonicCollection("Console")
{ {
{ "Reset", 'r' }, { "Reset", 'r' },
{ "Power", 'P' }, { "Power", 'P' },
@ -84,7 +76,7 @@ namespace BizHawk.Client.Common
{ "VS Coin 1", 'c' }, { "VS Coin 1", 'c' },
{ "VS Coin 2", 'C' } { "VS Coin 2", 'C' }
}, },
new MnemonicCollection("Player 1", false) new MnemonicCollection("Player 1")
{ {
{ "P1 Up", 'U' }, { "P1 Up", 'U' },
{ "P1 Down", 'D' }, { "P1 Down", 'D' },
@ -95,7 +87,7 @@ namespace BizHawk.Client.Common
{ "P1 B", 'B' }, { "P1 B", 'B' },
{ "P1 A", 'A' } { "P1 A", 'A' }
}, },
new MnemonicCollection("Player 2", false) new MnemonicCollection("Player 2")
{ {
{ "P2 Up", 'U' }, { "P2 Up", 'U' },
{ "P2 Down", 'D' }, { "P2 Down", 'D' },
@ -106,7 +98,7 @@ namespace BizHawk.Client.Common
{ "P2 B", 'B' }, { "P2 B", 'B' },
{ "P2 A", 'A' } { "P2 A", 'A' }
}, },
new MnemonicCollection("Player 3", false) new MnemonicCollection("Player 3")
{ {
{ "P3 Up", 'U' }, { "P3 Up", 'U' },
{ "P3 Down", 'D' }, { "P3 Down", 'D' },
@ -117,7 +109,7 @@ namespace BizHawk.Client.Common
{ "P3 B", 'B' }, { "P3 B", 'B' },
{ "P3 A", 'A' } { "P3 A", 'A' }
}, },
new MnemonicCollection("Player 4", false) new MnemonicCollection("Player 4")
{ {
{ "P4 Up", 'U' }, { "P4 Up", 'U' },
{ "P4 Down", 'D' }, { "P4 Down", 'D' },
@ -131,12 +123,12 @@ namespace BizHawk.Client.Common
}, },
new CoreMnemonicCollection(new []{ "SNES", "SGB" }) new CoreMnemonicCollection(new []{ "SNES", "SGB" })
{ {
new MnemonicCollection("Console", true) new MnemonicCollection("Console")
{ {
{ "Reset", 'r' }, { "Reset", 'r' },
{ "Power", 'P' }, { "Power", 'P' },
}, },
new MnemonicCollection("Player 1", false) new MnemonicCollection("Player 1")
{ {
{ "P1 Up", 'U' }, { "P1 Up", 'U' },
{ "P1 Down", 'D' }, { "P1 Down", 'D' },
@ -151,7 +143,7 @@ namespace BizHawk.Client.Common
{ "P1 L", 'L'}, { "P1 L", 'L'},
{ "P1 R", 'R'} { "P1 R", 'R'}
}, },
new MnemonicCollection("Player 2", false) new MnemonicCollection("Player 2")
{ {
{ "P2 Up", 'U' }, { "P2 Up", 'U' },
{ "P2 Down", 'D' }, { "P2 Down", 'D' },
@ -167,7 +159,7 @@ namespace BizHawk.Client.Common
{ "P2 R", 'R'} { "P2 R", 'R'}
}, },
new MnemonicCollection("Player 3", false) new MnemonicCollection("Player 3")
{ {
{ "P3 Up", 'U' }, { "P3 Up", 'U' },
{ "P3 Down", 'D' }, { "P3 Down", 'D' },
@ -182,7 +174,7 @@ namespace BizHawk.Client.Common
{ "P3 L", 'L'}, { "P3 L", 'L'},
{ "P3 R", 'R'} { "P3 R", 'R'}
}, },
new MnemonicCollection("Player 4", false) new MnemonicCollection("Player 4")
{ {
{ "P4 Up", 'U' }, { "P4 Up", 'U' },
{ "P4 Down", 'D' }, { "P4 Down", 'D' },