Exemplo n.º 1
0
        public static void Init()
        {
            bool flag = !new FileInfo(GenFilePaths.KeyPrefsFilePath).Exists;
            Dictionary <string, KeyBindingData> dictionary = DirectXmlLoader.ItemFromXmlFile <Dictionary <string, KeyBindingData> >(GenFilePaths.KeyPrefsFilePath, true);

            KeyPrefs.data = new KeyPrefsData();
            KeyPrefs.unresolvedBindings = new Dictionary <string, KeyBindingData>();
            foreach (KeyValuePair <string, KeyBindingData> current in dictionary)
            {
                KeyBindingDef namedSilentFail = DefDatabase <KeyBindingDef> .GetNamedSilentFail(current.Key);

                if (namedSilentFail != null)
                {
                    KeyPrefs.data.keyPrefs[namedSilentFail] = current.Value;
                }
                else
                {
                    KeyPrefs.unresolvedBindings[current.Key] = current.Value;
                }
            }
            if (flag)
            {
                KeyPrefs.data.ResetToDefaults();
            }
            KeyPrefs.data.AddMissingDefaultBindings();
            KeyPrefs.data.ErrorCheck();
            if (flag)
            {
                KeyPrefs.Save();
            }
        }
Exemplo n.º 2
0
        public KeyPrefsData Clone()
        {
            KeyPrefsData keyPrefsData = new KeyPrefsData();

            foreach (KeyValuePair <KeyBindingDef, KeyBindingData> keyValuePair in this.keyPrefs)
            {
                keyPrefsData.keyPrefs[keyValuePair.Key] = new KeyBindingData(keyValuePair.Value.keyBindingA, keyValuePair.Value.keyBindingB);
            }
            return(keyPrefsData);
        }
Exemplo n.º 3
0
        public KeyPrefsData Clone()
        {
            KeyPrefsData keyPrefsData = new KeyPrefsData();

            foreach (KeyValuePair <KeyBindingDef, KeyBindingData> current in this.keyPrefs)
            {
                keyPrefsData.keyPrefs[current.Key] = new KeyBindingData(current.Value.keyBindingA, current.Value.keyBindingB);
            }
            return(keyPrefsData);
        }