Ejemplo n.º 1
0
        public static string GetBind(string name)
        {
            string str;
            Func <Input.Button, bool> func    = null;
            List <Input.Button>       buttons = Input.buttons;
            Func <Input.Button, bool> func1   = func;

            if (func1 == null)
            {
                Func <Input.Button, bool> func2 = (Input.Button x) => x.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase);
                Func <Input.Button, bool> func3 = func2;
                func  = func2;
                func1 = func3;
            }
            using (IEnumerator <Input.Button> enumerator = buttons.Where <Input.Button>(func1).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Input.Button current = enumerator.Current;
                    str = (current.Binds != null ? string.Join(";", current.Binds) : "(nothing)");
                }
                else
                {
                    return("(button not found)");
                }
            }
            return(str);
        }
Ejemplo n.º 2
0
 public static void AddButton(string name, Func <bool> TestFunction, Action FrameThink = null)
 {
     if (Input.buttons.Any <Input.Button>((Input.Button x) => x.Name == name.ToLower()))
     {
         return;
     }
     Input.Button button = new Input.Button()
     {
         Name         = name.ToLower(),
         TestFunction = TestFunction
     };
     Input.buttons.Add(button);
     if (FrameThink != null)
     {
         Input.frameThinks.Add(FrameThink);
     }
 }
Ejemplo n.º 3
0
    public static void reset_cycle(Arg args)
    {
        string         name = args.GetString(0);
        List <KeyCode> keys;

        KeyCombos.TryParse(ref name, out keys);
        Facepunch.Input.Button button = Facepunch.Input.GetButton(name);
        if (button == null)
        {
            args.ReplyWith("Button not found");
        }
        else if (!button.Cycle)
        {
            args.ReplyWith("Button does not have a cycled bind");
        }
        else
        {
            button.CycleIndex = 0;
        }
    }