예제 #1
0
        private bool _RemoveButton(UIButtonBarItemModel _item)
        {
            bool _removed = false;

            if (!string.IsNullOrEmpty(_item.data))
            {
                if (_buttons.ContainsKey(_item.data))
                {
                    Destroy(_buttons [_item.data].gameObject);
                    _buttons.Remove(_item.data);
                    _removed = true;
                    if (_currentTabData.data.Equals(_item.data))
                    {
                        _currentTabData = null;
                        if (_buttons.Count > 0)
                        {
                            KeyValuePair <string, UIButtonBarItem> pair = _buttons.First();
                            UIButtonBarItemModel item = pair.Value.Data;
                            TabButtonPressed(item);
                        }
                    }
                }
            }
            return(_removed);
        }
예제 #2
0
        private void Initialize()
        {
            _currentTabData = null;
            _buttons        = new Dictionary <string, UIButtonBarItem> ();
            _backgroundVLG  = button.GetComponentInChildren <VerticalLayoutGroup> ();

            //UpdateConfiguration (UIConfig.tabBarConfig);
        }
예제 #3
0
 /// <summary>
 /// Adds the button.
 /// </summary>
 /// <param name="_item">Item.</param>
 public void AddButton(UIButtonBarItemModel _item)
 {
     if (!_buttons.ContainsKey(_item.data))
     {
         ResetLayout();
         _AddButton(_item);
         _reloadContainerLayout = 1;
     }
 }
예제 #4
0
        private void TabBarButtonHandler(UIButtonBarItemModel selected)
        {
            if (selected != null && !string.IsNullOrEmpty(selected.data))
            {
                FizzChannel channel = FizzService.Instance.GetChannelById(selected.data);
                if (selectedModelItem != null && !selectedModelItem.data.Equals(selected.data))
                {
                    chatView.Reset();
                }

                selectedModelItem           = selected;
                chatView.EnableFetchHistory = true;
                chatView.SetData(channel);
            }
        }
예제 #5
0
        private bool _AddButton(UIButtonBarItemModel _item)
        {
            bool _added = false;

            if (!_buttons.ContainsKey(_item.data))
            {
                UIButtonBarItem _button = Instantiate(button);
                _button.gameObject.SetActive(true);
                _button.transform.SetParent(container.transform, false);
                _button.transform.localScale = Vector3.one;
                _button.SetData(_item, TabButtonPressed);
                _buttons.Add(_item.data, _button);
                _added = true;
            }
            return(_added);
        }
예제 #6
0
 /// <summary>
 /// Resets the buttons.
 /// </summary>
 public void ResetButtons()
 {
     _currentTabData = null;
     if (_buttons == null)
     {
         return;
     }
     foreach (KeyValuePair <string, UIButtonBarItem> pair in _buttons)
     {
         UIButtonBarItem button = pair.Value;
         if (button != null)
         {
             Destroy(button.gameObject);
         }
     }
     _buttons.Clear();
 }
예제 #7
0
        private void TabButtonPressed(UIButtonBarItemModel data)
        {
            if (_currentTabData != null)
            {
                UIButtonBarItem currentButton = _buttons [_currentTabData.data];
                currentButton.SetInteractable(true);
            }

            _currentTabData = data;
            if (onBarItemPressed != null)
            {
                onBarItemPressed.Invoke(data);
            }

            UIButtonBarItem barButton = _buttons [data.data];

            barButton.SetInteractable(false);
        }
예제 #8
0
 /// <summary>
 /// Removes the button.
 /// </summary>
 /// <param name="data">Data.</param>
 public void RemoveButton(UIButtonBarItemModel _item)
 {
     ResetLayout();
     _RemoveButton(_item);
     _reloadContainerLayout = 1;
 }
예제 #9
0
 public void SetData(UIButtonBarItemModel data, Action <UIButtonBarItemModel> callback)
 {
     _item     = data;
     text.text = _item.text.ToUpper();
     _callback = callback;
 }