Mode switch handling, attempt two

This commit is contained in:
SDraw 2024-01-30 13:57:09 +03:00
parent 66b448a2c3
commit 84b0de7065
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
13 changed files with 256 additions and 288 deletions

View file

@ -40,11 +40,12 @@ namespace ml_lme
public static void SetModuleAsLast(this CVRInputManager p_instance, CVRInputModule p_module)
{
List<CVRInputModule> l_modules = ms_inputModules.GetValue(p_instance) as List<CVRInputModule>;
int l_lastIndex = l_modules.Count - 1;
int l_index = l_modules.FindIndex(p => p == p_module);
if(l_index != -1)
if((l_index != -1) && (l_index != l_lastIndex))
{
l_modules[l_index] = l_modules[l_modules.Count - 1];
l_modules[l_modules.Count - 1] = p_module;
l_modules[l_index] = l_modules[l_lastIndex];
l_modules[l_lastIndex] = p_module;
}
}