示例#1
0
 public static InputAction Duplicate(InputAction source)
 {
     return(Duplicate(source.m_name, source));
 }
        private void ReadInputBinding_V2(InputAction action, XmlNode node)
        {
            InputBinding binding = action.CreateNewBinding();

            foreach (XmlNode child in node.ChildNodes)
            {
                switch (child.LocalName)
                {
                case "Positive":
                    binding.Positive = InputBinding.StringToKey(child.InnerText);
                    break;

                case "Negative":
                    binding.Negative = InputBinding.StringToKey(child.InnerText);
                    break;

                case "DeadZoneType":
                    binding.DeadZoneType = InputBinding.StringToDeadZoneType(child.InnerText);
                    break;

                case "DeadZone":
                    binding.DeadZone = ReadAsFloat(child);
                    break;

                case "Gravity":
                    binding.Gravity = ReadAsFloat(child, 1.0f);
                    break;

                case "Sensitivity":
                    binding.Sensitivity = ReadAsFloat(child, 1.0f);
                    break;

                case "Scale":
                    binding.Scale = ReadAsFloat(child, 1.0f);
                    break;

                case "Snap":
                    binding.Snap = ReadAsBool(child);
                    break;

                case "Invert":
                    binding.Invert = ReadAsBool(child);
                    break;

                case "Type":
                    binding.Type = InputBinding.StringToInputType(child.InnerText);
                    break;

                case "Axis":
                    binding.Axis = ReadAsInt(child);
                    break;

                case "Joystick":
                    binding.Joystick = ReadAsInt(child);
                    break;

                case "GamepadButton":
                    binding.GamepadButton = InputBinding.StringToGamepadButton(child.InnerText);
                    break;

                case "GamepadAxis":
                    binding.GamepadAxis = InputBinding.StringToGamepadAxis(child.InnerText);
                    break;

                case "GamepadPlayer":
                    binding.GamepadIndex = InputBinding.StringToGamepadIndex(child.InnerText);
                    break;
                }
            }
        }
        private void ReadInputAction_V1(ControlScheme scheme, XmlNode node)
        {
            string       name    = ReadAttribute(node, "name", "Unnamed Axis");
            InputAction  action  = scheme.CreateNewAction(name);
            InputBinding binding = action.CreateNewBinding();

            foreach (XmlNode child in node.ChildNodes)
            {
                switch (child.LocalName)
                {
                case "description":
                    action.Description = child.InnerText;
                    break;

                case "positive":
                    binding.Positive = InputBinding.StringToKey(child.InnerText);
                    break;

                case "negative":
                    binding.Negative = InputBinding.StringToKey(child.InnerText);
                    break;

                case "deadZone":
                    binding.DeadZone = ReadAsFloat(child);
                    break;

                case "gravity":
                    binding.Gravity = ReadAsFloat(child, 1.0f);
                    break;

                case "sensitivity":
                    binding.Sensitivity = ReadAsFloat(child, 1.0f);
                    break;

                case "snap":
                    binding.Snap = ReadAsBool(child);
                    break;

                case "invert":
                    binding.Invert = ReadAsBool(child);
                    break;

                case "type":
                    binding.Type = InputBinding.StringToInputType(child.InnerText);
                    break;

                case "axis":
                    binding.Axis = ReadAsInt(child);
                    break;

                case "joystick":
                    binding.Joystick = ReadAsInt(child);
                    break;
                }
            }

            if (binding.Type == InputType.Button || binding.Type == InputType.DigitalAxis)
            {
                XmlNode      altPositiveNode = SelectSingleNode(node, "altPositive");
                XmlNode      altNegativeNode = SelectSingleNode(node, "altNegative");
                InputBinding secondary       = action.CreateNewBinding(binding);
                secondary.Positive = InputBinding.StringToKey(altPositiveNode.InnerText);
                secondary.Negative = InputBinding.StringToKey(altNegativeNode.InnerText);
            }
        }
示例#4
0
 public void DeleteAction(InputAction action)
 {
     m_actions.Remove(action);
 }