Beispiel #1
0
        public static string GetFriendlyStringOr(ControlCombination input1, ControlCombination input2)
        {
            tmp.Clear();

            if (input1 != null)
            {
                tmp.Append(input1.GetFriendlyString().ToUpper());
            }

            if (input2 != null)
            {
                string secondary = input2.GetFriendlyString();

                if (secondary.Length > 0)
                {
                    if (tmp.Length > 0)
                    {
                        tmp.Append(" or ");
                    }

                    tmp.Append(secondary.ToUpper());
                }
            }

            string val = tmp.ToString();

            tmp.Clear();
            return(val);
        }
Beispiel #2
0
        public static bool GetPressedOr(ControlCombination input1, ControlCombination input2, bool anyPressed = false, bool justPressed = false)
        {
            if (input1 != null && GetPressed(input1.combination, anyPressed, justPressed))
            {
                return(true);
            }

            if (input2 != null && GetPressed(input2.combination, anyPressed, justPressed))
            {
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        public static ControlCombination CreateFrom(string combinationString, bool logErrors = false)
        {
            if (combinationString == null)
            {
                return(null);
            }

            string[] data = combinationString.ToLower().Split(' ');

            if (data.Length == 0)
            {
                return(null);
            }

            ControlCombination obj = new ControlCombination();

            for (int d = 0; d < data.Length; d++)
            {
                string s = data[d].Trim();

                if (s.Length == 0 || obj.raw.Contains(s))
                {
                    continue;
                }

                object o;

                if (InputHandler.inputs.TryGetValue(s, out o))
                {
                    obj.raw.Add(s);
                    obj.combination.Add(o);
                }
                else
                {
                    if (logErrors)
                    {
                        Log.Info("WARNING: Input not found: " + s);
                    }

                    return(null);
                }
            }

            obj.combinationString = String.Join(" ", obj.raw);
            return(obj);
        }
Beispiel #4
0
        public static ControlCombination CreateFrom(string combinationString, bool logErrors = false)
        {
            if(combinationString == null)
                return null;

            string[] data = combinationString.ToLower().Split(' ');

            if(data.Length == 0)
                return null;

            var obj = new ControlCombination();

            for(int d = 0; d < data.Length; d++)
            {
                var s = data[d].Trim();

                if(s.Length == 0 || obj.raw.Contains(s))
                    continue;

                object o;

                if(InputHandler.inputs.TryGetValue(s, out o))
                {
                    obj.raw.Add(s);
                    obj.combination.Add(o);
                }
                else
                {
                    if(logErrors)
                        Log.Info("WARNING: Input not found: " + s);

                    return null;
                }
            }

            obj.combinationString = String.Join(" ", obj.raw);
            return obj;
        }
Beispiel #5
0
        public static bool GetPressedOr(ControlCombination input1, ControlCombination input2, bool anyPressed = false, bool justPressed = false)
        {
            if(input1 != null && GetPressed(input1.combination, anyPressed, justPressed))
                return true;

            if(input2 != null && GetPressed(input2.combination, anyPressed, justPressed))
                return true;

            return false;
        }
Beispiel #6
0
        public static string GetFriendlyStringOr(ControlCombination input1, ControlCombination input2)
        {
            tmp.Clear();

            if(input1 != null)
                tmp.Append(input1.GetFriendlyString().ToUpper());

            if(input2 != null)
            {
                string secondary = input2.GetFriendlyString();

                if(secondary.Length > 0)
                {
                    if(tmp.Length > 0)
                        tmp.Append(" or ");

                    tmp.Append(secondary.ToUpper());
                }
            }

            var val = tmp.ToString();
            tmp.Clear();
            return val;
        }