private void Awake() { string logCaller = "KeyboardInputManager.Awake()"; Log.Trace("method start", logCaller); DontDestroyOnLoad(this); //Don't go away on scene changes instance = this; Log.Trace("method end", logCaller); }
private void configLoadKeyBinds(ConfigNode cn) { string logCaller = "Settings.configCreateOrUpdateKeyBinds(ConfigNode)"; Log.Trace("method start", logCaller); string kb = "KeyBinds"; ConfigNode keyBindsNode; if (!config.HasNode(kb)) { string message = "No KeyBinds node found in config. This error is not fatal to the load process. Default keybinds will be used instead."; Log.Trace(message, logCaller); return; } keyBindsNode = config.GetNode(kb); ConfigNode.ValueList vl = keyBindsNode.values; foreach (TCKeyBinding k in KeyBinds) { string userAction = k.TCUserAction.ToString(); if (vl.Contains(userAction)) { string keycombo = vl.GetValue(userAction); List <KeyCode> iekc = KeyboardInputManager.GetKeyCombinationFromString(keycombo); if (iekc == null) { Log.Warning("Key combination is not defined correctly: " + keycombo + " - Using default for user action " + userAction, logCaller); continue; } if (iekc.Contains(KeyCode.None)) { k.KeyCombination = new List <KeyCode>(); } else { k.KeyCombination = new List <KeyCode>(iekc); k.KeyCombinationString = keycombo; } } } Log.Trace("method end", logCaller); }