Beispiel #1
0
    public void SaveSettings(BinaryFormatter bf, Stream file)
    {
        ControllerType controllerType = ControllerType.PC;

        bf.Serialize(file, 1);
        bf.Serialize(file, this.m_ActionsByInputAction.Count);
        foreach (KeyValuePair <int, InputActionData[]> keyValuePair in this.m_ActionsByInputAction)
        {
            int key = keyValuePair.Key;
            if (key < 117)
            {
                string name = EnumUtils <InputsManager.InputAction> .GetName((InputsManager.InputAction) key);

                bf.Serialize(file, name);
                InputActionData[] value = keyValuePair.Value;
                string            name2 = EnumUtils <KeyCode> .GetName((value != null && value[(int)controllerType] != null)?value[(int)controllerType].m_KeyCode : KeyCode.None);

                bf.Serialize(file, name2);
            }
        }
        foreach (KeyValuePair <int, InputActionData[]> keyValuePair2 in this.m_ActionsByInputAction)
        {
            if (keyValuePair2.Key >= 117)
            {
                string name3 = EnumUtils <TriggerAction.TYPE> .GetName(InputHelpers.GetTriggerAction(keyValuePair2.Key));

                bf.Serialize(file, name3);
                InputActionData[] value2 = keyValuePair2.Value;
                string            name4  = EnumUtils <KeyCode> .GetName((value2 != null && value2[(int)controllerType] != null)?value2[(int)controllerType].m_KeyCode : KeyCode.None);

                bf.Serialize(file, name4);
            }
        }
    }