Esempio n. 1
0
 protected virtual void OnButtonReleasedEvent(SectionButton button)
 {
     if (ButtonReleasedEvent != null)
     {
         ButtonReleasedEvent(this, button);
     }
 }
 private void OnButtonReleasedEvent(Section section, SectionButton button)
 {
     if (ButtonReleasedEvent != null)
     {
         ButtonReleasedEvent(this, section, button);
     }
 }
 private void OnButtonSelectedEvent(Section section, SectionButton button)
 {
     CheckCurrentSection(section);
     if (ButtonSelectedEvent != null)
     {
         ButtonSelectedEvent(this, section, button);
     }
 }
Esempio n. 4
0
 protected virtual void OnButtonUnSelectedEvent(SectionButton button)
 {
     if (CurrentButton != null)
     {
         SetCurrentButton(-1);
     }
     if (ButtonUnselectedEvent != null)
     {
         ButtonUnselectedEvent(this, button);
     }
 }
Esempio n. 5
0
 protected virtual void OnButtonSelectedEvent(SectionButton button)
 {
     if (button != CurrentButton)
     {
         SetCurrentButton(allSecionButtons.GetIndexOf(button));
     }
     if (ButtonSelectedEvent != null)
     {
         ButtonSelectedEvent(this, button);
     }
 }
Esempio n. 6
0
        private void PreviousButtonPressed(SectionButton button)
        {
            T[] all      = allItems.ToArray();
            T   oldValue = CurrentValue;

            currentValueIndex = all.GetLoopIndex(currentValueIndex - 1);
            SetLoopButtons();
            if (PreviousButtonUsedEvent != null)
            {
                PreviousButtonUsedEvent(this, oldValue, CurrentValue);
            }
        }
Esempio n. 7
0
        public void SetCurrentButton(int index)
        {
            int lastIndex = currentButtonIndex < 0 ? 0 : currentButtonIndex;

            lastIndex = index >= 0 ? lastIndex : -1;

            if (CurrentButton != null)
            {
                CurrentButton.Unselect();
            }

            currentButtonIndex = allSecionButtons.GetClampedIndex(index);
            bool available = index >= 0;

            if (available)
            {
                if (CurrentButton == null || !CurrentButton.Active)
                {
                    currentButtonIndex = lastIndex;
                    available          = false;
                    int dir = (index - currentButtonIndex);
                    dir = (int)Mathf.Sign(dir);
                    SectionButton testbutton = null;
                    for (int i = 1; i < allSecionButtons.Length; i++)
                    {
                        testbutton = allSecionButtons.GetLoop(currentButtonIndex + (dir * i));
                        if (testbutton != null && testbutton.Active)
                        {
                            available          = true;
                            currentButtonIndex = allSecionButtons.GetIndexOf(testbutton);
                            break;
                        }
                    }
                }
            }

            if (!available)
            {
                currentButtonIndex = lastIndex;
            }

            if (CurrentButton != null && CurrentButton.Active)
            {
                CurrentButton.Select();
            }
        }