- changed milestone to ui
-
assigned issue to
- changed title to [#modding] Method to get key assigned from command only return the first value found.```cs...
- edited description
[#modding] Method to get key assigned from command only return the first value found.```cs...
Marked for crossposting by: helado, who knits the icy cream
Message (jump):
<ZoraZ> Method to get key assigned from command only return the first value found.
cs // XRL.UI.LegacyKeyMapping.cs public static int GetKeyFromCommand(string Cmd) { foreach (KeyValuePair<string, Dictionary<string, int>> keyValuePair in LegacyKeyMapping.CurrentMap.PrimaryMapCommandToKeyLayer) { int result; if (keyValuePair.Value.TryGetValue(Cmd, out result)) { return result; } } foreach (KeyValuePair<string, Dictionary<string, int>> keyValuePair2 in LegacyKeyMapping.CurrentMap.SecondaryMapCommandToKeyLayer) { int result2; if (keyValuePair2.Value.TryGetValue(Cmd, out result2)) { return result2; } } return 0; }
So when I try to check keys press, it only works for the user-assigned primary key, the secondary one get ignored completely. As far as I dig the files there's no way around this so I have to write a util method myself, something like:
cs public static (int, int) GetAllKeysFromCommand(string Cmd) { int primary = 0; int secondary = 0; foreach (KeyValuePair<string, Dictionary<string, int>> keyValuePair in LegacyKeyMapping.CurrentMap.PrimaryMapCommandToKeyLayer) { if (keyValuePair.Value.TryGetValue(Cmd, out primary)) { break; } } foreach (KeyValuePair<string, Dictionary<string, int>> keyValuePair2 in LegacyKeyMapping.CurrentMap.SecondaryMapCommandToKeyLayer) { if (keyValuePair2.Value.TryGetValue(Cmd, out secondary)) { break; } } return (primary, secondary); }
Comments (6)
-
repo owner -
repo owner - changed status to resolved
fixed 9-17-2021
-
repo owner - changed status to open
-
repo owner - changed milestone to reef-major
-
repo owner - changed status to resolved
added KetAllKeysFromCommand for 10-15-2021
-
- removed milestone
Removing milestone: reef-major (automated comment)
- Log in to comment