Пример #1
0
        private void ListItemHookedChildTouchEventReceived(object sender, TouchEventArgs eventArgs)
        {
            TouchEvent primaryTouchEvent = eventArgs.TouchEvents.PrimaryTouchEvent;

            PopupList.PopupListPanelItem popupListPanelItem = sender as PopupList.PopupListPanelItem;
            if (popupListPanelItem != null)
            {
                switch (primaryTouchEvent.Type)
                {
                case TouchEventType.Up:
                    if (this.canSelectItem)
                    {
                        this.ApplyTouchItemIndex();
                        this.HideDialog();
                        if (this.SelectionChanged != null && this.previousSelectedIndex != this.selectedIndex)
                        {
                            this.SelectionChanged.Invoke(this, new PopupSelectionChangedEventArgs(this.previousSelectedIndex, this.SelectedIndex));
                        }
                    }
                    break;

                case TouchEventType.Down:
                    this.touchTotalTime = 0f;
                    this.touchItemIndex = popupListPanelItem.Index;
                    this.timerUpdate    = true;
                    this.canSelectItem  = true;
                    return;

                default:
                    return;
                }
            }
        }
Пример #2
0
 private void ListItemUpdater(ListPanelItem item)
 {
     if (item is PopupList.PopupListPanelItem)
     {
         PopupList.PopupListPanelItem popupListPanelItem = item as PopupList.PopupListPanelItem;
         popupListPanelItem.Height     = 50f;
         popupListPanelItem.Text       = this.ListItems[popupListPanelItem.Index];
         popupListPanelItem.IsSelected = (item.Index == this.listSelectedIndex);
     }
 }
Пример #3
0
 private ListPanelItem ListItemCreator()
 {
     PopupList.PopupListPanelItem popupListPanelItem = new PopupList.PopupListPanelItem();
     popupListPanelItem.selectedSprite.Image      = this.itemSelectedImageAsset;
     popupListPanelItem.selectedSprite.ShaderType = ShaderType.Texture;
     for (int i = 0; i < popupListPanelItem.selectedSprite.UnitCount; i++)
     {
         popupListPanelItem.selectedSprite.GetUnit(i).Color = this.itemSelectedImageColor;
     }
     popupListPanelItem.selectedImageNinePatch = this.itemSelectedImageNinePatch;
     popupListPanelItem.HookChildTouchEvent    = true;
     popupListPanelItem.TouchEventReceived    += new EventHandler <TouchEventArgs>(this.ListItemHookedChildTouchEventReceived);
     return(popupListPanelItem);
 }