//////////////////////////////////////////////////////////////////////////

    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);
    }
Esempio n. 2
0
    //////////////////////////////////////////////////////////////////////////

    protected override void OnInteract()
    {
        // Unity UI
        Dropdown dropDown = GetDropdown();

        if (dropDown != null)
        {
            prevSelectedIndex = dropDown.value;
            dropDown.Show();
        }

        // TextMesh Pro
        var tmpDropDown = GetTMPDropDown();

        if (tmpDropDown != null)
        {
            var pointerClickHandler = tmpDropDown.gameObject.GetComponent <IPointerClickHandler>();
            if (pointerClickHandler != null)
            {
                var pointer = new PointerEventData(EventSystem.current);
                pointerClickHandler.OnPointerClick(pointer);
            }
        }

#if ACCESS_NGUI
        // NGUI
        UIPopupList nGUIElement = GetNGUIDropdown();
        if (nGUIElement != null)
        {
            prevSelectedIndex = activeSelectionIndex;
            nGUIElement.Show();
        }
#endif
    }
Esempio n. 3
0
    static int Show(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        UIPopupList obj = (UIPopupList)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIPopupList");

        obj.Show();
        return(0);
    }
Esempio n. 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);
    }
Esempio n. 5
0
 static public int Show(IntPtr l)
 {
     try {
         UIPopupList self = (UIPopupList)checkSelf(l);
         self.Show();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 6
0
 static int Show(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UIPopupList obj = (UIPopupList)ToLua.CheckObject(L, 1, typeof(UIPopupList));
         obj.Show();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    private static int Show(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            UIPopupList uIPopupList = (UIPopupList)ToLua.CheckObject(L, 1, typeof(UIPopupList));
            uIPopupList.Show();
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
    //////////////////////////////////////////////////////////////////////////

    protected override void OnInteract()
    {
        Dropdown dropDown = GetDropdown();

        if (dropDown != null)
        {
            prevSelectedIndex = dropDown.value;
            dropDown.Show();
        }

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