コード例 #1
0
    //////////////////////////////////////////////////////////////////////////

    public override bool Decrement()
    {
        Dropdown dropDown = GetDropdown();

        if (dropDown != null)
        {
            if (dropDown.value == 0)
            {
                return(false);
            }

            --dropDown.value;
            return(true);
        }

#if ACCESS_NGUI
        UIPopupList nGUIElement = GetNGUIDropdown();
        if (nGUIElement != null)
        {
            if (activeSelectionIndex <= 0)
            {
                return(false);
            }

            nGUIElement.gameObject.SendMessage("OnNavigate", KeyCode.UpArrow);
            --activeSelectionIndex;
            nGUIElement.Set(nGUIElement.items[activeSelectionIndex]);
            nGUIElement.CloseSelf();
            nGUIElement.Show();
            return(true);
        }
#endif

        return(false);
    }
コード例 #2
0
    //////////////////////////////////////////////////////////////////////////

    protected override void OnInteractEnd()
    {
        prevSelectedIndex = -1;

        // Unity UI
        Dropdown dropDown = GetDropdown();

        if (dropDown != null)
        {
            dropDown.Hide();
        }

        // TextMesh Pro
        var tmpDropDown = GetTMPDropDown();

        if (tmpDropDown != null)
        {
            var cancelHandler = tmpDropDown.gameObject.GetComponent <ICancelHandler>();
            if (cancelHandler != null)
            {
                var eventData = new BaseEventData(EventSystem.current);
                cancelHandler.OnCancel(eventData);
            }
        }

#if ACCESS_NGUI
        // NGUI
        UIPopupList nGUIElement = GetNGUIDropdown();
        if (nGUIElement != null)
        {
            nGUIElement.CloseSelf();
        }
#endif
    }
コード例 #3
0
    /// <summary>
    /// Manually close the popup list.
    /// </summary>

    static public void Close()
    {
        if (current != null)
        {
            current.CloseSelf();
            current = null;
        }
    }
コード例 #4
0
    //////////////////////////////////////////////////////////////////////////

    public override bool Increment()
    {
        // Unity UI
        Dropdown dropDown = GetDropdown();

        if (dropDown != null)
        {
            if (dropDown.value == dropDown.options.Count - 1)
            {
                return(false);
            }

            ++dropDown.value;
            return(true);
        }

        // TextMesh Pro
        var tmpDropDown = GetTMPDropDown();

        if (tmpDropDown != null)
        {
            var valueInfo = tmpDropDown.GetType().GetProperty("value");
            if (valueInfo != null)
            {
                int valueIndex   = (int)valueInfo.GetValue(tmpDropDown, null);
                int optionsCount = GetItemCount();

                if (valueIndex == optionsCount - 1)
                {
                    return(false);
                }

                valueInfo.SetValue(tmpDropDown, valueIndex + 1, null);
                return(true);
            }
        }

#if ACCESS_NGUI
        // NGUI
        UIPopupList nGUIElement = GetNGUIDropdown();
        if (nGUIElement != null)
        {
            if (activeSelectionIndex == nGUIElement.items.Count - 1)
            {
                return(false);
            }

            nGUIElement.gameObject.SendMessage("OnNavigate", KeyCode.DownArrow);
            ++activeSelectionIndex;
            nGUIElement.Set(nGUIElement.items[activeSelectionIndex]);
            nGUIElement.CloseSelf();
            nGUIElement.Show();
            return(true);
        }
#endif

        return(false);
    }
コード例 #5
0
 static public int CloseSelf(IntPtr l)
 {
     try {
         UIPopupList self = (UIPopupList)checkSelf(l);
         self.CloseSelf();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #6
0
 static int CloseSelf(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UIPopupList obj = (UIPopupList)ToLua.CheckObject(L, 1, typeof(UIPopupList));
         obj.CloseSelf();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #7
0
    //////////////////////////////////////////////////////////////////////////

    protected override void OnInteractEnd()
    {
        prevSelectedIndex = -1;

        Dropdown dropDown = GetDropdown();

        if (dropDown != null)
        {
            dropDown.Hide();
        }

#if ACCESS_NGUI
        UIPopupList nGUIElement = GetNGUIDropdown();
        if (nGUIElement != null)
        {
            nGUIElement.CloseSelf();
        }
#endif
    }