コード例 #1
0
ファイル: Section.cs プロジェクト: Darkfafi/LanguageLearnGame
 protected virtual void OnButtonReleasedEvent(SectionButton button)
 {
     if (ButtonReleasedEvent != null)
     {
         ButtonReleasedEvent(this, button);
     }
 }
コード例 #2
0
 private void OnButtonReleasedEvent(Section section, SectionButton button)
 {
     if (ButtonReleasedEvent != null)
     {
         ButtonReleasedEvent(this, section, button);
     }
 }
コード例 #3
0
 private void OnButtonSelectedEvent(Section section, SectionButton button)
 {
     CheckCurrentSection(section);
     if (ButtonSelectedEvent != null)
     {
         ButtonSelectedEvent(this, section, button);
     }
 }
コード例 #4
0
ファイル: Section.cs プロジェクト: Darkfafi/LanguageLearnGame
 protected virtual void OnButtonUnSelectedEvent(SectionButton button)
 {
     if (CurrentButton != null)
     {
         SetCurrentButton(-1);
     }
     if (ButtonUnselectedEvent != null)
     {
         ButtonUnselectedEvent(this, button);
     }
 }
コード例 #5
0
ファイル: Section.cs プロジェクト: Darkfafi/LanguageLearnGame
 protected virtual void OnButtonSelectedEvent(SectionButton button)
 {
     if (button != CurrentButton)
     {
         SetCurrentButton(allSecionButtons.GetIndexOf(button));
     }
     if (ButtonSelectedEvent != null)
     {
         ButtonSelectedEvent(this, button);
     }
 }
コード例 #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);
            }
        }
コード例 #7
0
ファイル: Section.cs プロジェクト: Darkfafi/LanguageLearnGame
        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();
            }
        }