Esempio n. 1
0
        protected void ShowDropdown()
        {
            UpdateDropdownList();
            if (_list.selectionMode == ListSelectionMode.Single)
            {
                _list.selectedIndex = -1;
            }
            dropdown.width = this.width;
            _list.EnsureBoundsCorrect(); //avoid flicker

            object downward = null;

            if (_popupDirection == PopupDirection.Down)
            {
                downward = true;
            }
            else if (_popupDirection == PopupDirection.Up)
            {
                downward = false;
            }

            this.root.TogglePopup(dropdown, this, downward);
            if (dropdown.parent != null)
            {
                dropdown.displayObject.onRemovedFromStage.Add(__popupWinClosed);
                SetState(GButton.DOWN);
            }
        }
Esempio n. 2
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent<UIPanel>().ui;

        _list = _mainView.GetChild("mailList").asList;
        for (int i = 0; i < 10; i++)
        {
            MailItem item = (MailItem)_list.AddItemFromPool();
            item.setFetched(i % 3 == 0);
            item.setRead(i % 2 == 0);
            item.setTime("5 Nov 2015 16:24:33");
            item.title = "Mail title here";
        }

        _list.EnsureBoundsCorrect();
        float delay = 0f;
        for (int i = 0; i < 10; i++)
        {
            MailItem item = (MailItem)_list.GetChildAt(i);
            if (_list.IsChildInView(item))
            {
                item.PlayEffect(delay);
                delay += 0.2f;
            }
            else
                break;
        }
    }
Esempio n. 3
0
        void __addedToStage()
        {
            DispatchEvent("onPopup", null);

            if (autoSize)
            {
                _list.EnsureBoundsCorrect();
                int   cnt      = _list.numChildren;
                float maxDelta = -1000;
                for (int i = 0; i < cnt; i++)
                {
                    GButton obj = _list.GetChildAt(i).asButton;
                    if (obj == null)
                    {
                        continue;
                    }
                    GTextField tf = obj.GetTextField();
                    if (tf != null)
                    {
                        float v = tf.textWidth - tf.width;
                        if (v > maxDelta)
                        {
                            maxDelta = v;
                        }
                    }
                }

                if (contentPane.width + maxDelta > contentPane.initWidth)
                {
                    contentPane.width += maxDelta;
                }
                else
                {
                    contentPane.width = contentPane.initWidth;
                }
            }

            _list.selectedIndex = -1;
            _list.ResizeToFit(visibleItemCount > 0 ? visibleItemCount : int.MaxValue, 10);
        }
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Extension");
        UIObjectFactory.SetPackageItemExtension(UIPackage.GetItemURL("Extension", "mailItem"), typeof(MailItem));

        _mainView = UIPackage.CreateObject("Extension", "Main").asCom;
        _mainView.fairyBatching = true;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _list = _mainView.GetChild("mailList").asList;
        for (int i = 0; i < 10; i++)
        {
            MailItem item = (MailItem)_list.AddItemFromPool();
            item.setFetched(i % 3 == 0);
            item.setRead(i % 2 == 0);
            item.setTime("5 Nov 2015 16:24:33");
            item.title = "Mail title here";
        }

        _list.EnsureBoundsCorrect();
        float delay = 0f;
        for (int i = 0; i < 10; i++)
        {
            MailItem item = (MailItem)_list.GetChildAt(i);
            if (_list.IsChildInView(item))
            {
                item.PlayEffect(delay);
                delay += 0.2f;
            }
            else
                break;
        }
    }