protected override void DealShowData()
 {
     if (Data is Dictionary <string, object> )
     {
         ExtractData data = new ExtractData(Data, GetType());
         if (ShowArea)
         {
             var visible = data.Visible;
             ShowArea.SetActive(visible);
             if (visible)
             {
                 if (Option)
                 {
                     _dataDic = data.DataDic;
                     Option.Clear();
                     foreach (var item in data.DataDic)
                     {
                         Option.AddItem(item.Key);
                     }
                     if (Option.items.Count > 0)
                     {
                         var showName = Option.items[0];
                         Option.Set(showName);
                         _curCostType = showName;
                         _curCostData = _dataDic[showName] as ExtractItemData;
                     }
                     else
                     {
                         YxDebug.LogError("Extract types count is zero,please check again!");
                     }
                 }
             }
         }
     }
 }
    //////////////////////////////////////////////////////////////////////////

    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);
    }
Exemple #3
0
    //////////////////////////////////////////////////////////////////////////

    protected override void OnInteractAbort()
    {
        // Restore previous value
        if (prevSelectedIndex != -1)
        {
            Dropdown dropDown = GetDropdown();
            if (dropDown != null)
            {
                dropDown.value = prevSelectedIndex;
            }

            // TextMesh Pro
            var tmpDropDown = GetTMPDropDown();
            if (tmpDropDown != null)
            {
                var info = tmpDropDown.GetType().GetProperty("value");
                if (info != null)
                {
                    info.SetValue(tmpDropDown, prevSelectedIndex, null);
                }
            }

#if ACCESS_NGUI
            // NGUI
            UIPopupList nGUIElement = GetNGUIDropdown();
            if (nGUIElement != null)
            {
                nGUIElement.Set(nGUIElement.items[prevSelectedIndex]);
                activeSelectionIndex = prevSelectedIndex;
            }
#endif
        }

        OnInteractEnd();
    }
Exemple #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);
    }
 static public int Set(IntPtr l)
 {
     try {
         UIPopupList   self = (UIPopupList)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         System.Boolean a2;
         checkType(l, 3, out a2);
         self.Set(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #6
0
 static int Set(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UIPopupList obj  = (UIPopupList)ToLua.CheckObject(L, 1, typeof(UIPopupList));
         string      arg0 = ToLua.CheckString(L, 2);
         bool        arg1 = LuaDLL.luaL_checkboolean(L, 3);
         obj.Set(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    //////////////////////////////////////////////////////////////////////////

    protected override void OnInteractAbort()
    {
        // Restore previous value
        if (prevSelectedIndex != -1)
        {
            Dropdown dropDown = GetDropdown();
            if (dropDown != null)
            {
                dropDown.value = prevSelectedIndex;
            }

#if ACCESS_NGUI
            UIPopupList nGUIElement = GetNGUIDropdown();
            if (nGUIElement != null)
            {
                nGUIElement.Set(nGUIElement.items[prevSelectedIndex]);
                activeSelectionIndex = prevSelectedIndex;
            }
#endif
        }

        OnInteractEnd();
    }
Exemple #8
0
 protected override void DealShowData()
 {
     if (Data is Dictionary <string, object> )
     {
         ExtractData data = new ExtractData(Data, GetType());
         ViewVisible     = data.ExtractVisible;
         RecordVisible   = data.RecordVisible;
         BindCouldChange = data.CouldChangeBind;
         if (gameObject.activeInHierarchy)
         {
             StartCoroutine(OnVisibleAction.WaitExcuteCalls());
         }
         ExtracNotice.TrySetComponentValue(data.ExtractNotice);
         if (ViewVisible)
         {
             _dataDic = data.DataDic;
             if (Option)
             {
                 Option.Clear();
                 foreach (var item in data.DataDic)
                 {
                     Option.AddItem(item.Key);
                 }
                 if (Option.items.Count > 0)
                 {
                     var showName = Option.items[0];
                     Option.Set(showName);
                     _curCostType = showName;
                     _curCostData = _dataDic[showName] as ExtractItemData;
                 }
                 else
                 {
                     YxDebug.LogError("Extract types count is zero,please check again!");
                 }
             }
             else
             {
                 var tabWindow = MainYxView as YxTabPageWindow;
                 if (tabWindow)
                 {
                     List <TabData> datas = new List <TabData>();
                     foreach (var item in data.DataDic)
                     {
                         var     itemData = item.Value as ExtractItemData;
                         var     tabName  = itemData != null ? itemData.PlatformType: item.Key;
                         TabData tabData  = new TabData()
                         {
                             Name          = item.Key,
                             UpStateName   = string.Format(TabUpFormat, tabName),
                             DownStateName = string.Format(TabDownFormat, tabName),
                             Data          = item.Key
                         };
                         datas.Add(tabData);
                     }
                     tabWindow.TabDatas = datas.ToArray();
                     tabWindow.UpdateView();
                 }
             }
         }
     }
 }
Exemple #9
0
 public override void Set(string value, bool notify = true)
 {
     PopupLIist.Set(value, notify);
 }
 void OnLeftDropdownChanged(string s)
 {
     label.text = s;
     list.Set(s, false);
 }