Esempio n. 1
0
        /// <summary>
        /// Constructor for this module, will be child of the Application module to
        /// be executed as part of the Application.Run.
        /// </summary>
        /// <param name="bindConsole">The button to open and close the console</param>
        /// <param name="consoleMargin">The space between the screenspace and the console. Pass NULL to use the default value.</param>
        /// <param name="consoleBackground">The console background color or material. Pass NULL to use the default value.</param>
        /// <param name="consoleFontColor">The color for the font to display text. Pass NULL to use the default value.</param>
        /// <param name="maxNumberOfLines">The max. number of lines that will be displayed befor the oldest entry will be deleted. Pass NULL to use the default value.</param>
        public Module(InputButton bindConsoleButton, Margin consoleMargin, Material2DColored consoleBackground, Color consoleFontColor, int? maxNumberOfLines )
            : base("Delta.Console", typeof(Application))
        {

            if (consoleMargin.Left == 0 && consoleMargin.Top == 0 && consoleMargin.Right == 0)
            {
                consoleMargin = new Margin() { Left = 0.01f, Top = 0.01f, Right = 0.02f };
            }

            if (consoleBackground == null)
            {
                consoleBackground = new Material2DColored(new Color(new Color(0, 167, 255), 0.5f));
            }

            if (consoleFontColor.PackedRGBA == 0)
            {
                consoleFontColor = new Color(200, 220, 255);
            }

            if (maxNumberOfLines == null)
            {
                maxNumberOfLines = 20;
            }

            // Initialize
            console = new Delta.Console.Console(bindConsoleButton, consoleMargin, consoleBackground, consoleFontColor, (int)maxNumberOfLines);
            graph = new GraphManager();

            // Add command to the console to enable or disable the graph
            console.AddCmdToConsole(typeof(Module).GetMethod("SetGraphState"), this);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="container"></param>
        public void InstantiateIn(Control container)
        {
            switch (this.templateType)
            {
                case DataControlRowType.Header:
                    htmlControls.HtmlInputCheckBox checkBoxAll = new htmlControls.HtmlInputCheckBox();
                    checkBoxAll.ID = "checkall";
                    checkBoxAll.Name = this.checkItemName;
                    checkBoxAll.Value = "选全";
                    container.Controls.Add(checkBoxAll);

                    if (this.isMultiSelect == false)
                        checkBoxAll.Style["display"] = "none";

                    break;
                case DataControlRowType.DataRow:
                    InputButton checkBox = new InputButton();

                    checkBox.Name = this.checkItemName;
                    checkBox.ID = "checkitem";

                    if (this.isMultiSelect)
                        checkBox.ButtonType = InputButtonType.CheckBox;
                    else
                        checkBox.ButtonType = InputButtonType.Radio;

                    checkBox.Value = "";
                    container.Controls.Add(checkBox);
                    break;
            }
        }
Esempio n. 3
0
 public void resetTool()
 {
     inputButton = null;
     outputButton = null;
     if (NodePrinter.GetInstance().vidObj != null) {
         NodePrinter.GetInstance().PrintText();
     }
 }
Esempio n. 4
0
 public void Update(string Name, Keys Key, InputButton Button)
 {
     var bind = Bindings.IndexOf(Bindings.First(b => b.Name == Name));
     var bb = Bindings[bind];
     bb.Button = Button;
     bb.Key = Key;
     Bindings[bind] = bb;
 }
Esempio n. 5
0
 public Button(EntityHUDData.Button button)
 {
     this.hotkey = button.hotkey;
     if (button.buttonPrefab != null)
     {
         this.button = OverlayWindow.GetPooledWindow <OverlayWindow>(button.buttonPrefab);
     }
     this.action = button.buttonAction;
     this.toggle = button.toggle;
 }
Esempio n. 6
0
 // CharacterStats control to update
 private void UpdateControl(CharacterStatsSO characterStats)
 {
     Pause        = new InputButton(characterStats.Pause, XboxControllerButtons.Menu);
     Interact     = new InputButton(characterStats.Interact, XboxControllerButtons.Y);
     MeleeAttack  = new InputButton(characterStats.MeleeAttack, XboxControllerButtons.X);
     RangedAttack = new InputButton(characterStats.RangedAttack, XboxControllerButtons.B);
     Jump         = new InputButton(characterStats.Jump, XboxControllerButtons.A);
     Horizontal   = new InputAxis(characterStats.HorizontalPositive, characterStats.HorizontalNegative, XboxControllerAxes.LeftstickHorizontal);
     Vertical     = new InputAxis(characterStats.VerticalPositive, characterStats.VerticalNegative, XboxControllerAxes.LeftstickVertical);
 }
Esempio n. 7
0
 public BaseInput()
 {
     FireButton = new InputButton("Fire", RewiredConsts.Action.Fire);
     //BoostButton = new InputButton("Boost", RewiredConsts.Action.Boost);
     ButtonList = new List <InputButton>();
     ButtonList.Add(FireButton);
     ButtonList.Add(BoostButton);
     LeftStick  = new InputStick();
     RightStick = new InputStick();
 }
Esempio n. 8
0
 public Input(InputType inputType, InputButton inputButton, Vector2 position)
 {
     this.StartPosition    = position;
     this.PreviousPosition = position;
     this.CurrentPosition  = position;
     this.InputState       = InputState.Pressed;
     this.InputType        = inputType;
     this.InputButton      = inputButton;
     this.FirstPressed     = DateTime.Now;
 }
 public Entity ReplaceInput(InputButton newValue) {
     var previousComponent = hasInput ? input : null;
     var component = _inputComponentPool.Count > 0 ? _inputComponentPool.Pop() : new InputComponent();
     component.value = newValue;
     ReplaceComponent(ComponentIds.Input, component);
     if (previousComponent != null) {
         _inputComponentPool.Push(previousComponent);
     }
     return this;
 }
Esempio n. 10
0
        //adds Remove button to InputPanel for removing a query row
        private void AddRemoveButton()
        {
            InputButton btn = new InputButton();

            btn.Image       = imageList1.Images[0];
            btn.ToolTipText = "Remove";
            btn.Break       = BreakType.Row;
            btn.Click      += new EventHandler(btn_Click);
            c1InputPanel1.Items.Insert(c1InputPanel1.Items.Count - 2, btn);
        }
Esempio n. 11
0
 public InputRow(bool active, string name, string unityInput, KeyCode k, InputButton pressed, InputType itype)
 {
     this.name   = name;
     this.active = active;
     type        = itype;
     key         = k;
     input       = unityInput;
     GetPressed  = pressed;
     inputSystem = new DefaultInput();
 }
Esempio n. 12
0
    public static void InteractWithButton(string _buttonID, InputButtonStates _newbuttonState)
    {
        InputButton button = RetrieveButtonByID(_buttonID);

        if (button != null)
        {
            button.ChangeButtonState(_newbuttonState);
        }
        return;
    }
Esempio n. 13
0
 public InputRow()
 {
     active.Value = true;
     name         = "InputName";
     type         = InputType.Input;
     input        = "Value";
     key          = KeyCode.A;
     GetPressed   = InputButton.Press;
     inputSystem  = new DefaultInput();
 }
Esempio n. 14
0
        //this event fires when a remove button is clicked
        //will remove an entire row of InputComponents from InputPanel
        void btn_Click(object sender, EventArgs e)
        {
            InputButton btn   = (InputButton)sender;
            int         index = c1InputPanel1.Items.IndexOf(btn);

            c1InputPanel1.Items.RemoveAt(index);
            c1InputPanel1.Items.RemoveAt(index - 1);
            c1InputPanel1.Items.RemoveAt(index - 2);
            c1InputPanel1.Items.RemoveAt(index - 3);
            c1InputPanel1.Items.RemoveAt(index - 4);
        }
Esempio n. 15
0
 public InputTrigger GetButtonTrigger(InputButton button)
 {
     if (this.bindings.ContainsKey(button))
     {
         return(this.bindings[button].Trigger);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 16
0
 public void SetBinding(InputButton button, InputTrigger trigger)
 {
     if (trigger != null)
     {
         this.bindings[button] = new InputBinding(button, trigger);
     }
     else if (this.bindings.ContainsKey(button))
     {
         this.bindings.Remove(button);
     }
 }
Esempio n. 17
0
        public InputTrigger GetTrigger(int setNumber, InputButton button)
        {
            if (setNumber >= this.sets.Count)
            {
                return(null);
            }

            var set = this.sets[setNumber];

            return(set.GetButtonTrigger(button));
        }
Esempio n. 18
0
    public virtual void addButton_toLayout()
    {
        RectTransform rt    = (RectTransform)Instantiate(button, new Vector3(0, 0, 0), Quaternion.identity);
        InputButton   input = rt.GetComponent <InputButton>();

        input.vidObj = node;
        rt.SetParent(layout.transform, false);
        buttons.Add(rt);
        input.argumentIndex = buttons.Count;
        node.incromentInputs();
    }
Esempio n. 19
0
 public void SetKeyMap()
 {
     Pause            = new InputButton(Pause.key, Pause.controllerButton, playerNum);
     ThrowRope        = new InputButton(ThrowRope.key, ThrowRope.controllerButton, playerNum);
     Dash             = new InputButton(Dash.key, Dash.controllerButton, playerNum);
     Pull             = new InputButton(Pull.key, Pull.controllerButton, playerNum);
     PlayerHorizontal = new InputAxis(PlayerHorizontal.positive, PlayerHorizontal.negative, PlayerHorizontal.controllerAxis, playerNum);
     PlayerVertical   = new InputAxis(PlayerVertical.positive, PlayerVertical.negative, PlayerVertical.controllerAxis, playerNum);
     AimerHorizontal  = new InputAxis(AimerHorizontal.positive, AimerHorizontal.negative, AimerHorizontal.controllerAxis, playerNum);
     AimerVertical    = new InputAxis(AimerVertical.positive, AimerVertical.negative, AimerVertical.controllerAxis, playerNum);
 }
Esempio n. 20
0
 /// <summary>
 /// Gets the state of the given button.
 /// </summary>
 public ButtonState GetButton(InputButton button)
 {
     if (ButtonStateMap.ContainsKey(button))
     {
         return(ButtonStateMap[button]);
     }
     else
     {
         throw new InvalidOperationException(string.Format("Unable to find button name '{0}'.", button));
     }
 }
        public List <InputTrigger> GetTriggers(int deviceNumber, InputButton button)
        {
            if (deviceNumber < 0 || deviceNumber >= this.devices.Count)
            {
                return(null);
            }

            var device = this.devices[deviceNumber];

            return(device.BindingSets.GetTriggers(button));
        }
        public InputTrigger GetTrigger(int deviceNumber, int setNumber, InputButton button)
        {
            if (deviceNumber < 0 || deviceNumber >= this.devices.Count)
            {
                return(null);
            }

            var device = this.devices[deviceNumber];

            return(device.BindingSets.GetTrigger(setNumber, button));
        }
Esempio n. 23
0
        public void SetBinding(int setNumber, InputButton button, InputTrigger trigger)
        {
            if (setNumber >= this.sets.Count)
            {
                return;
            }

            var set = this.sets[setNumber];

            set.SetBinding(button, trigger);
        }
        public void SetBinding(int deviceNumber, int setNumber, InputButton button, InputTrigger trigger)
        {
            if (deviceNumber < 0 || deviceNumber >= this.devices.Count)
            {
                return;
            }

            var device = this.devices[deviceNumber];

            device.BindingSets.SetBinding(setNumber, button, trigger);
        }
Esempio n. 25
0
 public void SignalRelease(InputButton btn)
 {
     for (int i = this.btnSignals.Count - 1; i >= 0; i--)
     {
         if (this.btnSignals[i].btn == btn)
         {
             this.btnSignals.RemoveAt(i);
             return;
         }
     }
 }
Esempio n. 26
0
 public void SignalPress(InputButton btn)
 {
     for (int i = 0; i < this.btnSignals.Count; i++)
     {
         if (this.btnSignals[i].btn == btn)
         {
             return;
         }
     }
     this.btnSignals.Add(new PlayerController.BtnState(btn));
 }
Esempio n. 27
0
    public InputContainer()
    {
        for (int i = 0; i < NUM_BUTTONS; ++i)
        {
            inButton[i] = new InputButton();
        }

        for (int i = 0; i < NUM_AXIS; ++i)
        {
            inAxis[i] = new InputAxis();
        }
    }
Esempio n. 28
0
    private static InputButton RetrieveButtonByID(string _buttonID)
    {
        // TODO implement exception for no registered button with id.
        InputButton buttonToReturn = null;
        InputButton button         = null;

        if (activeButtons.TryGetValue(_buttonID, out button))
        {
            buttonToReturn = button;
        }
        return(buttonToReturn);
    }
Esempio n. 29
0
 private int FindRowForInputButton(InputButton button)
 {
     for (int row = 0; row < this.ControlsGridView.Rows.Count; row++)
     {
         InputButton?rowButton = this.FindInputButtonForRow(row);
         if (rowButton.HasValue && rowButton.Value == button)
         {
             return(row);
         }
     }
     return(-1);
 }
Esempio n. 30
0
        public virtual void ResetBurstFireCount(ClipInfo clipInfo, InputButton inputButton)
        {
            if (clipInfo == null || clipInfo.FiringType != FiringType.BURST)
            {
                return;
            }

            if (Input.Released(inputButton))
            {
                _burstCount = 0;
            }
        }
Esempio n. 31
0
 public void Reset(int id, int unityFingerId, InputType inputType, InputButton inputButton, Vector2 position)
 {
     this.Id               = id;
     this.UnityFingerId    = unityFingerId;
     this.StartPosition    = position;
     this.PreviousPosition = position;
     this.CurrentPosition  = position;
     this.InputState       = InputState.Pressed;
     this.InputType        = inputType;
     this.InputButton      = inputButton;
     this.FirstPressed     = DateTime.Now;
 }
    private void Start()
    {
        Button componentInParent = GetComponentInParent <Button>();

        inputButton        = componentInParent.gameObject.AddComponent <InputButton>();
        inputButton.Action = Action;
        trayButton         = componentInParent.GetComponent <TrayInputButton>();
        if (trayButton != null)
        {
            trayButton.OnStateChanged += inputButton.OnButtonStateChanged;
        }
    }
Esempio n. 33
0
 public bool InputUp(KeyCode code, InputButton button)
 {
     if (UnityEngine.Input.GetKeyUp(code))
     {
         Input(button, InputState.UP);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 34
0
    void ReadKeyCodesFromPreferences()
    {
        ClearAllInputs();

        ActionA = RegisterInput("ActionA", KeyCode.Space, KeyCode.JoystickButton0);
        ActionB = RegisterInput("ActionB", KeyCode.Return, KeyCode.JoystickButton2);
        Cancel  = RegisterInput("Cancel", KeyCode.Escape, KeyCode.JoystickButton1);
        Left    = RegisterInput("Left", KeyCode.LeftArrow, KeyCode.Keypad4);
        Right   = RegisterInput("Right", KeyCode.RightArrow, KeyCode.Keypad6);
        Up      = RegisterInput("Top", KeyCode.UpArrow, KeyCode.Keypad8);
        Down    = RegisterInput("Bottom", KeyCode.DownArrow, KeyCode.Keypad2);
    }
Esempio n. 35
0
 public InputData()
 {
     this.pointerId     = -1;
     this.position      = Vector2.zero;
     this.delta         = Vector2.zero;
     this.pressPosition = Vector2.zero;
     this.clickTime     = 0.0f;
     this.clickCount    = 0;
     this.scrollDelta   = Vector2.zero;
     this.dragging      = false;
     this.button        = InputButton.Left;
 }
Esempio n. 36
0
        public PointerEventData(EventSystem eventSystem) : base(eventSystem)
        {
            eligibleForClick = false;

            pointerId = -1;
            position = Vector2.zero; // Current position of the mouse or touch event
            delta = Vector2.zero; // Delta since last update
            pressPosition = Vector2.zero; // Delta since the event started being tracked
            clickTime = 0.0f; // The last time a click event was sent out (used for double-clicks)
            clickCount = 0; // Number of clicks in a row. 2 for a double-click for example.

            scrollDelta = Vector2.zero;
            useDragThreshold = true;
            dragging = false;
            button = InputButton.Left;
        }
 public override bool GetButtonDown(InputButton button)
 {
     return buttonStates [button] == ButtonState.Pressed;
 }
        public Vector2 DrawButtonWithText(InputButton button, string text, Vector2 position, Color color, Renderer renderer, bool flip = false)
        {
            if (text != null && text.Length == 0)
                text = null;

            TextureData textureData = Input.GamePadUsedLast ? gamepadButtonTextureData[button] : keyboardButtonTextureData;
            Vector2 minScale = Game1.MinScreenScaleFactor;
            Vector2 textSize = renderer.Font.MeasureString(text ?? "I", Font.DefaultSize * minScale.Y);
            Vector2 buttonScale = new Vector2((textSize.Y * 1.1f) / textureData.Height);
            float halfButtonWidth = textureData.Width * 0.5f * buttonScale.X;
            Vector2 flipScale = flip ? new Vector2(-1.0f, 1.0f) : Vector2.One;

            if (text != null)
            {
                float buttonHeight = textureData.Height * buttonScale.Y;
                if (!Input.GamePadUsedLast)
                    buttonHeight -= buttonScale.Y;
                Vector2 backingSize = new Vector2((textSize.X * 1.1f) + (halfButtonWidth * 2.0f), buttonHeight);
                Vector2 backingPosition = position + new Vector2(halfButtonWidth, 0.0f);
                if (flip)
                    backingPosition.X -= backingSize.X;
                renderer.Draw(whitePixelTextureData, backingPosition, UiColor, 0.0f, backingSize * flipScale, false);
                const float borderScale = 0.2f;
                Vector2 borderScaleX = new Vector2(backingSize.X / BorderTextureData[N].Width, borderScale * minScale.Y);
                renderer.Draw(BorderTextureData[N], backingPosition, Color.White, 0.0f, borderScaleX * flipScale, false);
                renderer.Draw(BorderTextureData[S], backingPosition + new Vector2(0.0f, backingSize.Y - (BorderTextureData[S].Height * borderScaleX.Y)), Color.White, 0.0f, borderScaleX * flipScale, false);
                Vector2 cornerScale = borderScale * minScale;
                float cornerX = flip ? -BorderTextureData[NE].Width * cornerScale.X : backingSize.X;
                renderer.Draw(BorderTextureData[flip ? NW : NE], backingPosition + new Vector2(cornerX, 0.0f), Color.White, 0.0f, cornerScale, false);
                renderer.Draw(BorderTextureData[flip ? SW : SE], backingPosition + new Vector2(cornerX, backingSize.Y - (BorderTextureData[SE].Height * cornerScale.Y)), Color.White, 0.0f, cornerScale, false);
                Vector2 borderScaleY = new Vector2(borderScale * minScale.X, (backingSize.Y - (BorderTextureData[NE].Height * cornerScale.Y * 2.0f)) / BorderTextureData[E].Height);
                renderer.Draw(BorderTextureData[flip ? W : E], backingPosition + new Vector2(cornerX, BorderTextureData[NE].Height * cornerScale.Y), Color.White, 0.0f, borderScaleY, false);
                Vector2 textPosition = backingPosition + (flip ? Vector2.Zero : new Vector2(halfButtonWidth, 0.0f)) + ((backingSize - new Vector2(halfButtonWidth, 0.0f) - textSize) / 2.0f) + new Vector2(0.0f, minScale.Y);
                renderer.DrawText(text, textPosition, color, 0.0f, Vector2.Zero, minScale);
            }

            renderer.Draw(textureData, position, color, 0.0f, buttonScale, false);
            if (!Input.GamePadUsedLast)
            {
                text = Input.KeyboardMapping[button].ToString();
                textSize = renderer.Font.MeasureString(text, Font.DefaultSize);
                renderer.DrawText(text, new Vector2(position.X + (((halfButtonWidth * 2.0f) - textSize.X) / 2.0f), position.Y), Color.White, 0.0f, Vector2.Zero, minScale);
            }
            return textureData.Size * buttonScale;
        }
 public override bool GetButtonUp(InputButton button)
 {
     return Input.GetButtonUp("P"+playerNumber+"_"+button);
 }
Esempio n. 40
0
        protected void HandleInput()
        {
            if (input_lag > 0) input_lag--;

            Game.WaitForInput();
            KeyboardState ks = Keyboard.GetState();

            if (ks.IsKeyDown(Key.LShift) || ks.IsKeyDown(Key.RShift))
            {
                m_field.Lift();
            }

            if (ks.IsKeyDown(Key.Space))
            {
                if (btn != InputButton.Switch)
                {
                    btn = InputButton.Switch;
                    m_field.Switch();
                }
            }
            else if (ks.IsKeyDown(Key.Left))
            {
                if (btn != InputButton.Left)
                {
                    btn = InputButton.Left;
                    input_lag = 10;
                    if (m_field.CruiserPos.X > 0) m_field.CruiserPos = new Point(m_field.CruiserPos.X - 1, m_field.CruiserPos.Y);
                }
                else if (input_lag == 0)
                {
                    if (m_field.CruiserPos.X > 0) m_field.CruiserPos = new Point(m_field.CruiserPos.X - 1, m_field.CruiserPos.Y);
                }
            }
            else if (ks.IsKeyDown(Key.Right))
            {
                if (btn != InputButton.Right)
                {
                    btn = InputButton.Right;
                    input_lag = 10;
                    if (m_field.CruiserPos.X < 4) m_field.CruiserPos = new Point(m_field.CruiserPos.X + 1, m_field.CruiserPos.Y);
                }
                else if (input_lag == 0)
                {
                    if (m_field.CruiserPos.X < 4) m_field.CruiserPos = new Point(m_field.CruiserPos.X + 1, m_field.CruiserPos.Y);
                }
            }
            else if (ks.IsKeyDown(Key.Up))
            {
                if (btn != InputButton.Up)
                {
                    btn = InputButton.Up;
                    input_lag = 10;
                    if (m_field.CruiserPos.Y < 11) m_field.CruiserPos = new Point(m_field.CruiserPos.X, m_field.CruiserPos.Y + 1);
                }
                else if (input_lag == 0)
                {
                    if (m_field.CruiserPos.Y < 11) m_field.CruiserPos = new Point(m_field.CruiserPos.X, m_field.CruiserPos.Y + 1);
                }
            }
            else if (ks.IsKeyDown(Key.Down))
            {
                if (btn != InputButton.Down)
                {
                    btn = InputButton.Down;
                    input_lag = 10;
                    if (m_field.CruiserPos.Y > 0) m_field.CruiserPos = new Point(m_field.CruiserPos.X, m_field.CruiserPos.Y - 1);
                }
                else if (input_lag == 0)
                {
                    if (m_field.CruiserPos.Y > 0) m_field.CruiserPos = new Point(m_field.CruiserPos.X, m_field.CruiserPos.Y - 1);
                }
            }
            else
            {
                btn = InputButton.None;
            }
        }
 public static bool ButtonPressed(InputButton button)
 {
     return buttonCheckBindings[button]();
 }
 public void ReleaseButton(InputButton button)
 {
     buttonStates[button] = ButtonState.Released;
 }
Esempio n. 43
0
 public Binding FromButton(InputButton Button)
 {
     return Bindings.FirstOrDefault(bind => bind.Button == Button);
 }
Esempio n. 44
0
 public Binding(string aName, InputButton? aButton, Keys? aKey)
 {
     Name = aName;
     Button = aButton;
     Key = aKey;
 }
 public abstract bool GetButton(InputButton button);
Esempio n. 46
0
 public bool RemoveAction(InputButton button)
 {
     return buttonConfig.Remove(button);
 }
Esempio n. 47
0
 public bool AddAction(InputButton button, IAction action)
 {
     if (buttonConfig.ContainsKey(button)) return false;
     buttonConfig.Add(button, action);
     return true;
 }
 public override bool GetButtonUp(InputButton button)
 {
     return buttonStates [button] == ButtonState.Released;
 }
 public void PressButton(InputButton button)
 {
     buttonStates[button] = ButtonState.Pressed;
 }
Esempio n. 50
0
 public void Add(string Name, Keys? Key, InputButton? Button = null)
 {
     Bindings.Add(new Binding() { Name = Name, Button = Button, Key = Key });
 }
Esempio n. 51
0
    // Use this for initialization
    void Start()
    {
        scriptButton1 = button1.GetComponent<InputButton>();
        scriptButton2 = button2.GetComponent<InputButton>();
        scriptButton3 = button3.GetComponent<InputButton>();
        scriptButton4 = button4.GetComponent<InputButton>();

        TheButtons = new List<InputButton>();
        TheButtons.Add(scriptButton1);
        TheButtons.Add(scriptButton2);
        TheButtons.Add(scriptButton3);
        TheButtons.Add(scriptButton4);

        displayText = display.GetComponent<Text>();

        //currentState = State.waiting;
        timeToChange = 1;
        currentTime = 0.0f;
        displayTime = "05:00";
        timeRemaining = 300;
        decount = 1;
        FinishLight = Random.Range(1,5);

        RefreshText();
    }
Esempio n. 52
0
        public Console(InputButton bindConsoleButton, Margin consoleMargin, Material2DColored consoleBackground, Color consoleFontColor, int maxNumberOfLines)
        {
            // Set the Material2DColored
            this.consoleBackground = consoleBackground;
            // The console should be topmost
            this.consoleBackground.DrawLayer = Delta.ContentSystem.Rendering.RenderLayer.Front;

            // Set the margin and max. line count
            this.consoleMargin = consoleMargin;
            this.maxNumberOfLines = maxNumberOfLines;

            // Initialize the console dimension
            consoleDimension = new Rectangle();

            // Initialize empty history
            history = new List<string>();
            cmdHistory = new Stack<string>();

            // Initialize empty suggestions
            autoCompletionCache = new List<string>();

            // Initialize with empty string
            inputText = "";
            lastInputText = "";

            // Set the console font with the given color
            consoleFont = new Font(Font.Default, consoleFontColor, HorizontalAlignment.Left, VerticalAlignment.Top);

            // Create a new instance of the CommandManager
            cmdManager = new CommandManager();

            // Register input commands
            registerInputCommands(bindConsoleButton);

            // Initialize calculation
            calculateConsoleDimension();
        }
Esempio n. 53
0
 public bool SetAction(InputButton button, IAction action)
 {
     if (!buttonConfig.ContainsKey(button)) return false;
     buttonConfig[button] = action;
     return true;
 }
Esempio n. 54
0
 public bool GetButton(InputButton Button)
 {
     throw new NotImplementedException();
 }
Esempio n. 55
0
        private void registerInputCommands(InputButton bindConsoleButton)
        {
            // Show or hide the console
            Input.Commands["Console"]
                .AddTrigger(new CommandTrigger { Button = bindConsoleButton, State = InputState.Pressed })
                .Add(this, command =>
                {
                    // Invert value
                    showConsole = !showConsole;

                    // Workaround to delete all previous entered text
                    // http://forum.deltaengine.net/yaf_postsm2636_Input-Keyboard-HandleInput-alternative.aspx#post2636
                    var killText = "";
                    Input.Keyboard.HandleInput(ref killText);
                });

            // Evaluate and execute a entered command
            Input.Commands["ExecuteCmd"]
                .AddTrigger(new CommandTrigger { Button = InputButton.Enter, State = InputState.Pressed })
                .Add(this, command =>
                {
                    // Only execute when the console is visible
                    if (showConsole)
                    {
                        executeCmd();
                        cmdHistoryPosition = 0;
                    }
                });

            // Do autocompletion
            Input.Commands["AutoComplete"]
                .AddTrigger(new CommandTrigger { Button = InputButton.Tab, State = InputState.Pressed })
                .Add(this, command =>
                {
                    // Only execute when the console is visible and we have input to process
                    if (showConsole && !string.IsNullOrWhiteSpace(inputText))
                    {
                        // Try to autocomplete the input to a matching command
                        var text = cmdManager.AutoCompleteString(inputText);
                        inputText = text;
                        cmdHistoryPosition = 0;
                    }
                });

            // Step through history when pressing CursorUp or CursorDown
            Input.Commands["StepThroughHistory"]
                .AddTrigger(new CommandTrigger { Button = InputButton.CursorUp, State = InputState.Pressed })
                .AddTrigger(new CommandTrigger { Button = InputButton.CursorDown, State = InputState.Pressed })
                .Add(this, command =>
                {
                    if (showConsole)
                    {
                        if (command.Button == InputButton.CursorUp)
                        {
                            moveHistoryUp();
                        }
                        else
                        {
                            moveHistoryDown();
                        }
                    }
                });
        }
Esempio n. 56
0
 private void DoButtonDown(InputButton Button, XboxButtons XboxButton)
 {
     buttonStates[(int)XboxButton] = true;
     OnButtonDown(Button);
 }
Esempio n. 57
0
        public bool GetButton(InputButton Button)
        {
            if (Controller != null)
            {
                if (Controller.IsConnected)
                {
                    switch (Button)
                    {
                        case InputButton.BumperLeft:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.BumperRight:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.TriggerLeft:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.TriggerRight:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.StickLeft:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.StickRight:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.LFaceUp:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.LFaceLeft:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.LFaceRight:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.LFaceDown:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.RFaceUp:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.RFaceLeft:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.RFaceRight:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.RFaceDown:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.CenterLeft:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.CenterRight:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.CenterMiddle:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.Extra1:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.Extra2:
                            return Controller.GetButtonState(DS4Button.L1);

                        case InputButton.Extra3:
                            return Controller.GetButtonState(DS4Button.L1);
                    }
                }
            }
            return false;
        }
Esempio n. 58
0
 private void DoButtonUp(InputButton Button, XboxButtons XboxButton)
 {
     buttonStates[(int)XboxButton] = false;
     OnButtonUp(Button);
 }
Esempio n. 59
0
 public bool IsButtonDown(InputButton Button)
 {
     return false;
 }
Esempio n. 60
0
 private void Xbox360Driver_OnButtonUp(InputButton Button)
 {
     Console.WriteLine("ButtonUp " + Button);
 }