Esempio n. 1
0
        // ------------------
        public bool IsDuplicateOf(GamepadProfile profile)
        {
            if (!this.joystickIdentifier.Equals(profile.joystickIdentifier, System.StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }


            for (int i = 0; i < GamepadManager.GamepadKeyCount; ++i)
            {
                if (!this.GetKeySource(i).IsDuplicateOf(profile.GetKeySource(i)))
                {
                    return(false);
                }
            }

            for (int i = 0; i < GamepadManager.GamepadStickCount; ++i)
            {
                if (!this.GetJoystickSource(i).IsDuplicateOf(profile.GetJoystickSource(i)))
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 2
0
        // ---------------------
        virtual protected GamepadProfile GetInternalGenericProfile()
        {
            if (this.genericProfile == null)
            {
                this.genericProfile = new GamepadProfile.GenericProfile();
            }

            return(this.genericProfile);
        }
Esempio n. 3
0
        // --------------------
        public int FindDuplicate(GamepadProfile profile)
        {
            for (int i = 0; i < this.profileList.Count; ++i)
            {
                if (this.profileList[i].IsDuplicateOf(profile))
                {
                    return(i);
                }
            }

            return(-1);
        }
Esempio n. 4
0
        // -------------------
        public GamepadProfile GetProfile(string deviceName)
        {
            for (int i = 0; i < this.profileList.Count; ++i)
            {
                GamepadProfile profile = this.profileList[i];
                if (profile.IsCompatible(deviceName))
                {
                    return(profile);
                }
            }

            return(null);
        }
Esempio n. 5
0
 // -------------------
 public void GetCompatibleProfiles(string deviceName, List <GamepadProfile> targetList)
 {
     for (int i = 0; i < this.profileList.Count; ++i)
     {
         GamepadProfile profile = this.profileList[i];
         if (profile.IsCompatible(deviceName))
         {
             if (!targetList.Contains(profile))
             {
                 targetList.Add(profile);
             }
         }
     }
 }
Esempio n. 6
0
        // -------------------
        public GamepadProfile AddProfile(GamepadProfile profile)
        {
            if (profile == null)
            {
                return(null);
            }

            int duplicateId = this.FindDuplicate(profile);

            if (duplicateId >= 0)
            {
                GamepadProfile originalProfile = this.profileList[duplicateId];
                this.profileList.RemoveAt(duplicateId);
                this.profileList.Insert(0, originalProfile);

                originalProfile.AddSupportedVersion(profile.unityVerTo);

                return(originalProfile);
            }

            this.profileList.Insert(0, profile);

            return(profile);
        }