Ejemplo n.º 1
0
        private void Update()
        {
            if (Input.GetButtonDown("Jump") || Input.GetKeyDown(KeyCode.Space) || Input.GetButtonDown(ButtonType.Y.ToString()))
            {
                if (OnActionEvent != null)
                {
                    OnActionEvent.Invoke(ActionType.Jump);
                }
            }

            if (Input.GetButtonDown("Fire1") || Input.GetButtonDown(ButtonType.R.ToString()))
            {
                if (OnActionEvent != null)
                {
                    OnActionEvent.Invoke(ActionType.Attack);
                }
            }

            if (Input.GetKeyDown(KeyCode.R) || Input.GetButtonDown(ButtonType.A.ToString()))
            {
                if (OnActionEvent != null)
                {
                    OnActionEvent.Invoke(ActionType.Avoid);
                }
            }
        }
Ejemplo n.º 2
0
        private void NextItem()
        {
            IsPlaying = true;
            list[0].action.Invoke();

            onNextItem.Invoke(list[0]);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 接受到消息
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Consumer_Recevied(object sender, BasicDeliverEventArgs e)
 {
     try
     {
         //获取消息返回对象
         var result = EventMessage.BuildEventMessageResult(e.Body);
         //触发外部监听事件
         _actionMessage?.Invoke(result);
         if (!result.IsOperationOk)
         {
             //未能消费此消息,重新放入队列头
             Context.ListenChannel.BasicReject(e.DeliveryTag, true);
         }
         else if (!Context.ListenChannel.IsClosed)
         {
             Context.ListenChannel.BasicAck(e.DeliveryTag, false);
         }
     }
     catch (Exception exception)
     {
         //todo 记录日志
         //Console.WriteLine(exception);
         //throw;
     }
 }
Ejemplo n.º 4
0
 void GetChangeOrderInput()
 {
     if (Input.GetKeyDown(KeyCode.Q))
     {
         ChangeOrderInput?.Invoke();
     }
 }
Ejemplo n.º 5
0
        public void SendEvent(string name)
        {
            MyEventArgs mea = new MyEventArgs();

            mea.Info = "work done : " + name;
            ActionEvent.Invoke(mea);
        }
Ejemplo n.º 6
0
 void GetJumpInput()
 {
     if (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.W))
     {
         JumpInput?.Invoke();
     }
 }
Ejemplo n.º 7
0
 void GetResetStageInput()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         ResetStageInput?.Invoke();
     }
 }
 public override void Execute()
 {
     if (ActionOccurred())
     {
         boundEvent.Invoke();
     }
 }
Ejemplo n.º 9
0
    // ITEM FUNCTIONALITY --------------------------------------------------------------------------------------------- |

    private void gainItem(typeOfItem item)
    {
        switch (item)
        {
        case typeOfItem.health:
            health += 50;
            if (health > 100)
            {
                health = 100;
            }
            IGotHit.Invoke(MyTeam, playerNumber, health);
            break;

        case typeOfItem.speed:
            addSpeed();
            //IPerformed.Invoke(actions.speed, MyTeam, playerNumber, 0);
            break;

        case typeOfItem.power:
            addPower();
            //IPerformed.Invoke(actions.powerUp, MyTeam, playerNumber, 0);
            break;

        case typeOfItem.points:
            IPerformed.Invoke(actions.points, MyTeam, playerNumber, 10);
            break;
        }
    }
Ejemplo n.º 10
0
 void GetActionInput()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         ActionInput?.Invoke();
     }
 }
Ejemplo n.º 11
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            _spaceCount++;
            FloatEvent?.Invoke(_spaceCount);

            ActionEvent?.Invoke(true, 56);
        }
    }
Ejemplo n.º 12
0
 public static void RegisterClickEvent(this Button button, ActionEvent actionEvent, bool handled = false)
 {
     button.Click += (object sender, RoutedEventArgs e) => {
         actionEvent?.Invoke();
         if (handled)
         {
             e.Handled = true;
         }
     };
 }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            ObservableCollection <StaffServiceTimeModel> models = new ObservableCollection <StaffServiceTimeModel>();

            foreach (StaffServiceTimeModel model in serviceList.Items)
            {
                models.Add(model);
            }
            ActionEvent?.Invoke(this, models);
            this.m_Popup.IsOpen = false;
        }
Ejemplo n.º 14
0
 public void Withdraw(int sum)
 {
     if (Sum >= sum)
     {
         Sum -= sum;
         ActionEvent?.Invoke("вы сняли бабки");
     }
     else
     {
         ActionEvent?.Invoke("недостаточно средств");
     }
 }
Ejemplo n.º 15
0
 public void Withdraw(int sum)
 {
     if (Sum >= sum)
     {
         Sum -= sum;
         ActionEvent?.Invoke("Вы сняли на своего счета " + sum + ". Остаток " + Sum);
     }
     else
     {
         ActionEvent?.Invoke("Недостаточно средтсв");
     }
 }
Ejemplo n.º 16
0
        // Down Handler
        protected override void DownHandler()
        {
            if (useDown)
            {
                downHandler.Invoke();
            }

            if (broadcast)
            {
                downEvent.Invoke();
            }
        }
Ejemplo n.º 17
0
        private void EvaluateButton()
        {
            switch (inputState)
            {
            case InputState.Pressed:
                if (InputManager.GetButtonDown(buttonName, playerID))
                {
                    onAction.Invoke();
                }
                break;

            case InputState.Released:
                if (InputManager.GetButtonUp(buttonName, playerID))
                {
                    onAction.Invoke();
                }
                break;

            case InputState.Held:
                if (InputManager.GetButton(buttonName, playerID))
                {
                    onAction.Invoke();
                }
                break;
            }
        }
Ejemplo n.º 18
0
    private void CompleteAction()
    {
        Listeners.InvokePerformEvent(currentlyExecutingAction);

        if (actionQueue.Count > 0)
        {
            PerformAction(actionQueue.Dequeue());
        }
        else //we're done here
        {
            OnFinishPerform.Invoke(currentlyExecutingAction);
        }
    }
Ejemplo n.º 19
0
    void FireEvent()
    {
        Interactable i = Interaction();

        if (i != null)
        {
            InteractEvent?.Invoke(i);
        }
        else if (can_input)
        {
            DashEvent?.Invoke();
        }
    }
Ejemplo n.º 20
0
        /// <summary>
        /// Keyタイプの入力処理
        /// </summary>
        /// <param name="key"></param>
        /// <param name="mappingData"></param>
        /// <param name="inputEvent"></param>
        private void HandleActionInput(ActionEventKey key, ActionMapping.MappingData mappingData, ActionEvent inputEvent)
        {
            var keyCodeList        = mappingData.keyCodeList;
            var virtualKeyCodeList = mappingData.virtualKeyCodeList;

            foreach (var code in keyCodeList)
            {
                if (getKeyDelegateTable[key.trigger](code))
                {
                    inputEvent.Invoke();
                    return;
                }
            }

            foreach (var code in virtualKeyCodeList)
            {
                if (getVirtualKeyDelegateTable[key.trigger](code))
                {
                    inputEvent.Invoke();
                    return;
                }
            }
        }
Ejemplo n.º 21
0
        private void Consumer(object sender, BasicDeliverEventArgs e)
        {
            try
            {
                var result = MessageFactory.GetMessageResult(e.Body);
                _action_message?.Invoke(result);    //触发外部侦听事件

                if (Context.ReceiveChannel.IsClosed == false)
                {
                    Context.ReceiveChannel.BasicAck(e.DeliveryTag, false);
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 22
0
    public void PerformAction <T>(T action) where T : GameAction
    {
        if (IsExecutingAction())
        {
            actionQueue.Enqueue(action);
        }
        else
        {
            OnBeginPerform.Invoke(action);

            currentlyExecutingAction = action;

            if (Viewers.HasViewers(action))
            {
                StartActionViewers(action);
            }
            else
            {
                CompleteAction();
            }
        }
    }
Ejemplo n.º 23
0
        public void testAction(InputMethod inputMethod, float distance, InputHandler handler)
        {
            performedAction = performingAction;

            //Check if the input types are the same
            bool inputTypeMatches = (inputMethod.Type & type) != InputType.None;

            //If they are, check if the action is being performed
            performingAction = inputTypeMatches ? isPerformingAction(inputMethod, distance, handler) : false;

            if (!performedAction && performingAction)
            {
                OnActionStarted.Invoke(inputMethod, distance, handler);
            }
            if (performingAction)
            {
                OnActionUpdate.Invoke(inputMethod, distance, handler);
            }
            if (performedAction && !performingAction)
            {
                OnActionEnded.Invoke(inputMethod, distance, handler);
            }
        }
Ejemplo n.º 24
0
 void OnSelectHandler()
 {
     OnSelect.Invoke(_action);
 }
Ejemplo n.º 25
0
 public void SendActionEvent(ActionEventArgs e)
 {
     ActionEvent?.Invoke(this, e);
 }
    IEnumerator WaitForPlay()
    {
        yield return(new WaitForSeconds(timeToWaitAfter));

        waitAfter.Invoke();
    }
Ejemplo n.º 27
0
 private void OnAction(object sender, SSEActionsEventArgs e)
 {
     ActionEvent?.Invoke(this, e);
 }
Ejemplo n.º 28
0
 public void LoadData()
 {
     InitiateEvent?.Invoke(this, new InitiateEventArgs());
     ActionEvent?.Invoke(this, new InitiateEventArgs());
 }
Ejemplo n.º 29
0
 private void DispatchActionEvent(SSEClientActions action)
 {
     ActionEvent?.Invoke(this, new SSEActionsEventArgs(action));
 }
Ejemplo n.º 30
0
 private void Web_Action(string obj)
 {
     ActionEvent?.Invoke(obj);
 }