Ejemplo n.º 1
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Update Currently Active Buttons
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void UpdateCurrentlyActiveButtons()
    {
        foreach (ActiveInputButtons activeInput in m_lCurrentInput)
        {
            Button_Base[] activeButtons = activeInput.buttonObject.GetComponents <Button_Base>();
            for (int i = 0; i < activeButtons.Length; ++i)
            {
                if (activeButtons[i].enabled)
                {
                    ButtonState eButtonState = ButtonState.NO_CHANGE;
                    if (activeInput.inputTriggered)
                    {
                        eButtonState = ButtonState.TRIGGERED;
                    }
                    else
                    {
                        ActiveInputButtons previousFrameInfo = m_lPreviousInput.GetExisting(activeInput.buttonObject);
                        if (previousFrameInfo != null && previousFrameInfo.touchIDs.Count < activeInput.touchIDs.Count)
                        {
                            eButtonState = ButtonState.CLICKED;
                        }
                    }

                    activeButtons[i].PushInputSystem(activeInput.touchIDs, eButtonState);
                }
            }
        }
    }
Ejemplo n.º 2
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Update Released Buttons
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    private void UpdateReleasedButtons()
    {
        foreach (ActiveInputButtons previousFrameButton in m_lPreviousInput)
        {
            if (m_lCurrentInput.GetExisting(previousFrameButton.buttonObject) == null)
            {
                Button_Base[] releasedButtons = previousFrameButton.buttonObject.GetComponents <Button_Base>();
                for (int i = 0; i < releasedButtons.Length; ++i)
                {
                    if (releasedButtons[i].enabled)
                    {
                        if (releasedButtons[i].KeepPressedEvenWithNoContact)
                        {
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
                            if (Input.GetMouseButton(previousFrameButton.touchIDs.First.Value))
#else
                            if (Input.touchCount > previousFrameButton.touchIDs.First.Value)
#endif
                            {
                                previousFrameButton.inputTriggered = false;
                                m_lCurrentInput.AddLast(previousFrameButton);
                            }
                            else
                            {
                                releasedButtons[i].PushInputSystem(null, ButtonState.RELEASED);
                            }
                        }
                        else
                        {
                            releasedButtons[i].PushInputSystem(null, ButtonState.RELEASED);
                        }
                    }
                }
            }
        }
    }