Exemple #1
0
        /// <summary>
        /// Returns true if they are the same
        /// </summary>
        /// <param name="p">ActivationMode to compare with</param>
        /// <returns>True if both are the same, else false</returns>
        public bool Equals(ActivationMode p)
        {
            // If parameter is null return false:
            if (( object )p == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return((Name == p.Name) && (MultiTap == p.MultiTap));
        }
Exemple #2
0
        public override bool Equals(System.Object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }

            // If parameter cannot be cast to Point return false.
            ActivationMode p = obj as ActivationMode;

            if ((System.Object)p == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return(this.Equals(p));
        }
Exemple #3
0
 /// <summary>
 /// cTor: copy constructor
 /// </summary>
 /// <param name="other"></param>
 public ActivationMode(ActivationMode other)
 {
     this.Name     = other.Name;
     this.MultiTap = other.MultiTap;
 }
        /// <summary>
        /// Assumes to be in an action element
        /// retrieves the attributes and collects the various control=binding pairs
        /// </summary>
        /// <param name="xr">An XML reader @ StartElement</param>
        private void CollectActions(Dictionary <string, string> attr)
        {
            //first find an ActivationMode if there is - applies to all actions
            string actModeName = ActivationMode.Default.Name;
            string multiTap    = "0";

            // this can be an Activation Mode OR a multitap
            // if there is an activationMode the multiTap remains 0
            // if no ActivationMode is given, multitap is 1 or may be 2...
            if (attr.ContainsKey("ActivationMode"))
            {
                actModeName = attr["ActivationMode"];
                multiTap    = ActivationModes.Instance.MultiTapFor(actModeName).ToString( ); // given by the already collected items
            }
            else
            {
                // name remains default - we handle multiTaps only here
                multiTap = "1"; // default if not changed in the action to may be 2 or so..
                if (attr.ContainsKey("multiTap"))
                {
                    multiTap = attr["multiTap"];
                }
            }
            ActivationMode actMode = new ActivationMode(actModeName, int.Parse(multiTap)); // should be a valid ActivationMode for this action

            // we collect actions for each input ie for K,J,X and M
            if (attr.ContainsKey("joystick"))
            {
                ProfileAction ac = new ProfileAction( );
                ac.name              = attr["name"];
                ac.devID             = "J";
                ac.defBinding        = attr["joystick"];
                ac.defActivationMode = actMode;
                if (ac.defBinding == " ")
                {
                    ac.defBinding = Joystick.JoystickCls.BlendedInput;
                    m_currentMap.Add(ac); // finally add it to the current map if it was bound
                }
                else if (!String.IsNullOrEmpty(ac.defBinding))
                {
                    ac.defBinding = "js1_" + ac.defBinding;
                    m_currentMap.Add(ac); // finally add it to the current map if it was bound
                }
            }

            if (attr.ContainsKey("keyboard"))
            {
                ProfileAction ac = new ProfileAction( );
                ac.name              = attr["name"];
                ac.devID             = "K";
                ac.defBinding        = attr["keyboard"];
                ac.defActivationMode = actMode;
                if (ac.defBinding == " ")
                {
                    ac.defBinding = Keyboard.KeyboardCls.BlendedInput;
                    m_currentMap.Add(ac); // finally add it to the current map if it was bound
                }
                else if (!String.IsNullOrEmpty(ac.defBinding))
                {
                    ac.defBinding = "kb1_" + ac.defBinding;
                    m_currentMap.Add(ac); // finally add it to the current map if it was bound
                }
            }

            if (attr.ContainsKey("mouse"))   // 20151220BM: add mouse device (from AC 2.0 defaultProfile usage)
            {
                ProfileAction ac = new ProfileAction( );
                ac.name              = attr["name"];
                ac.devID             = "M";
                ac.defBinding        = attr["mouse"];
                ac.defActivationMode = actMode;
                if (ac.defBinding == " ")
                {
                    ac.defBinding = Mouse.MouseCls.BlendedInput;
                    m_currentMap.Add(ac); // finally add it to the current map if it was bound
                }
                else if (!String.IsNullOrEmpty(ac.defBinding))
                {
                    ac.defBinding = "mo1_" + ac.defBinding;
                    m_currentMap.Add(ac); // finally add it to the current map if it was bound
                }
            }

            if (attr.ContainsKey("xboxpad"))
            {
                ProfileAction ac = new ProfileAction( );
                ac.name              = attr["name"];
                ac.devID             = "X";
                ac.defBinding        = attr["xboxpad"];
                ac.defActivationMode = actMode;
                if (ac.defBinding == " ")
                {
                    ac.defBinding = Gamepad.GamepadCls.BlendedInput;
                    m_currentMap.Add(ac); // finally add it to the current map if it was bound
                }
                else if (!String.IsNullOrEmpty(ac.defBinding))
                {
                    ac.defBinding = "xi1_" + ac.defBinding;
                    m_currentMap.Add(ac); // finally add it to the current map if it was bound
                }
            }
            if (attr.ContainsKey("ps3pad"))
            {
                // ignore
            }
        }