Exemplo n.º 1
0
 public void OnClick()
 {
     if (OnButtonPress != null)
     {
         OnButtonPress.Invoke(null, null);
     }
 }
Exemplo n.º 2
0
 public void PressButton(object sender, ButtonPressEventArgs e)
 {
     if (OnButtonPress != null)
     {
         OnButtonPress.Invoke(sender, e);
     }
 }
Exemplo n.º 3
0
        void OnMultiPress(object sender, ButtonPressEventArgs args)
        {
            if (args.Event.Type != Gdk.EventType.TwoButtonPress)
            {
                OnButtonPress?.Invoke(this, args);
                return;
            }

            OnButtonDoublePress?.Invoke(this, args);
        }
Exemplo n.º 4
0
        public virtual void Update(GameTime gameTime)
        {
            var currentState = Keyboard.GetState();

            foreach (var pair in Bindings)
            {
                if (currentState.IsKeyDown(pair.Key) && lastState.IsKeyUp(pair.Key))
                {
                    OnButtonPress?.Invoke(pair.Key, pair.Value);
                }
            }
        }
Exemplo n.º 5
0
        protected void NodeDataRecieved(object sender, NodeEvent eventData)
        {
            var val = int.Parse(eventData.Value.ToString()); // Seems to be the only way to get this?

            OnButtonPress?.Invoke(val);
            if (Handlers.ContainsKey(val))
            {
                foreach (var handler in Handlers[val])
                {
                    handler(val);
                }
            }
        }
Exemplo n.º 6
0
        public void Disable()
        {
            GetComponent <Renderer>().material.color = disabledColor;
            foreach (ButtonCallBack b in OnButtonPress.GetInvocationList())
            {
                OnButtonPress -= b;
            }

            HighlightOnRaycast highlight = GetComponent <HighlightOnRaycast>();

            if (highlight != null)
            {
                Destroy(highlight);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Update the state of this element
        /// </summary>
        /// <param name="DeltaTime">Game clock.</param>
        public void Update(IFrameBasedClock clock)
        {
            while (currentState != null && currentState.Events.Count > 0)
            {
                IInputEvent e = currentState.Events.Dequeue();

                if (e is InputEvent <JoypadKeyEventArgs> keyEvent && keyEvent.Name == "OnButtonPress")
                {
                    OnButtonPress?.Invoke(this, keyEvent.Info);
                }

                if (e is InputEvent <JoypadAxeEventArgs> modEvent && modEvent.Name == "OnAxeMovement")
                {
                    OnAxeMovement?.Invoke(this, modEvent.Info);
                }
            }
        }
Exemplo n.º 8
0
        public void PressButton()
        {
            InputManager.ClickTime++;
            DateTime now = DateTime.Now;

            if (prePressTime != null)
            {
                TimeSpan ts = now - (DateTime)prePressTime;
                if (ts.TotalSeconds < 0.3f || !Platform.IsActive)
                {
                    return;
                }
            }
            prePressTime = now;
            if (OnButtonPress != null)
            {
                OnButtonPress.Invoke(this, null);
            }
        }
Exemplo n.º 9
0
    public void AddListenerButtonPress(string butonName, OnButtonPress action)
    {
        if (dicListenerButtonPress == null)
        {
            dicListenerButtonPress = new Dictionary <string, OnButtonPress>();
        }

        if (dicListenerButtonPress.ContainsKey(butonName))
        {
            if (dicListenerButtonPress[butonName] == null)
            {
                dicListenerButtonPress[butonName] = action;
            }
            dicListenerButtonPress[butonName] += action;
        }
        else
        {
            dicListenerButtonPress.Add(butonName, action);
        }
    }
Exemplo n.º 10
0
        public virtual void PressButton(GameObject other)
        {
#if UNITY_EDITOR
            if (verbose)
            {
                print("button pressed");
            }
#endif
            if (OnButtonPress != null)
            {
                OnButtonPress.Invoke(other);
            }

            string eventName = gameObject.name;
            var    extra     = new Dictionary <string, object>();
            extra["parent"] = gameObject.transform.parent.name;
            if (!eventName.Equals("Body"))
            {
                StatisticsTracking.StartEvent("Button Press", eventName, extra);
            }
        }
Exemplo n.º 11
0
        private void Race_KeyDown_1(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Up)
            {
                if (speedInGame < 21)
                {
                    speedInGame++;
                }
            }

            if (e.KeyCode == Keys.Down)
            {
                if (speedInGame > 0)
                {
                    speedInGame--;
                }
            }


            OnButtonPress?.Invoke(sender, e);
        }
Exemplo n.º 12
0
 public void OnPress()
 {
     obp = UIController._instance.hasSelecSever.GetComponent <OnButtonPress>();
     obp.severSelect(this.gameObject);
     obp.isSeverPress = true;
 }
Exemplo n.º 13
0
 public virtual void ButtonPress()
 {
     OnButtonPress?.Invoke();
 }
Exemplo n.º 14
0
 void OnPress(object sender, EventArgs args)
 {
     OnButtonPress?.Invoke(this, args);
 }
 /// <summary>
 /// Called the player presses a button or in no hands mode drives near the button.
 /// </summary>
 public static void ButtonPress(int id)
 {
     OnButtonPress?.Invoke(id);
 }
Exemplo n.º 16
0
 public void ButtonPressed(string text)
 {
     OnButtonPress?.Invoke(text);
 }
 public override void Execute()
 {
     OnButtonPress?.Invoke();
 }