Ejemplo n.º 1
0
        public UiInputBinding(ContentManager Content) : base(Content, new string[0])
        {
            rebindTime   = -1;
            bindingOrder = new List <Bindings>();
            foreach (Bindings command in Enum.GetValues(typeof(Bindings)))
            {
                bindingOrder.Add(command);
            }

            this.setStrings(buildStrings(-1));
            this.addCallback(element =>
            {
                if (selected == bindingOrder.Count) // Defaults
                {
                    InputBindings.loadDefaults();
                    this.setStrings(buildStrings(-1));
                    this.finished = false;
                }
                else if (selected == bindingOrder.Count + 1) // Save+Exit
                {
                    InputBindings.saveKeybinds();
                }
                else if (selected == bindingOrder.Count + 2) // Discard+Exit
                {
                    InputBindings.loadKeybinds();
                }
                else // editing binding at bindingOrder[selected]
                {
                    rebind = bindingOrder[selected];
                    this.setStrings(buildStrings(selected));
                    rebindTime    = 0;
                    this.finished = false;
                }
            });
        }