public static void LoadSettings()
        {
            ConfigNode fileNode = ConfigNode.Load(BDArmorySettings.settingsConfigURL);

            if (!fileNode.HasNode("BDAInputSettings"))
            {
                fileNode.AddNode("BDAInputSettings");
            }

            ConfigNode cfg = fileNode.GetNode("BDAInputSettings");

            FieldInfo[] fields = typeof(BDInputSettingsFields).GetFields();
            for (int i = 0; i < fields.Length; i++)
            {
                string fieldName = fields[i].Name;
                if (!cfg.HasValue(fieldName))
                {
                    continue;
                }
                BDInputInfo orig   = (BDInputInfo)fields[i].GetValue(null);
                BDInputInfo loaded = new BDInputInfo(cfg.GetValue(fieldName), orig.description);
                fields[i].SetValue(null, loaded);
            }

            fileNode.Save(BDArmorySettings.settingsConfigURL);
        }
Пример #2
0
 public static bool GetKeyDown(BDInputInfo input)
 {
     return(input.inputString != string.Empty && Input.GetKeyDown(input.inputString));
 }