private void LoadKeyBoard() { defaultKeyboard = new AbstractKeyboard(); defaultKeyboard.Load(defaultKeyboardMapping.text); keyboard = new AbstractKeyboard(); try { keyboard.Load(File.ReadAllText(KeyBoardMappingFilePath)); // Use default values to fill missing keys foreach (AbstractKey ak in Enum.GetValues(typeof(AbstractKey))) { if (!keyboard.Data.ContainsKey(ak)) { keyboard.Data[ak] = GetDefaultCompoundKeys(ak); } } } catch { Debug.LogWarning("Nova: Failed to load input mapping file, use default input mapping."); keyboard.Data = GetDefaultKeyboardData(); } }
private void LoadKeyBoard() { keyboard = new AbstractKeyboard(); try { keyboard.Load(File.ReadAllText(KeyBoardMappingFilePath)); } catch { Debug.LogWarning("Nova: Failed to load input mapping file, use default input mapping."); keyboard.Load(defaultKeyboardMapping.text); } // load default keyboard defaultKeyboard = new AbstractKeyboard(); defaultKeyboard.Load(defaultKeyboardMapping.text); }