Ejemplo n.º 1
0
        void ItemClick(EventCallBack eventCall, UserAction action)
        {
            if (Checked != null)
            {
                Checked.SetActive(false);
            }
            PopItemMod mod = eventCall.DataContext as PopItemMod;

            if (mod == null)
            {
                return;
            }
            if (mod.Checked != null)
            {
                mod.Checked.SetActive(true);
            }
            SelectIndex = mod.Index;
            if (ShowLabel != null)
            {
                if (mod.data is string)
                {
                    ShowLabel.text = mod.data as string;
                }
                else
                {
                    ShowLabel.text = mod.data.ToString();
                }
            }
            if (OnSelectChanged != null)
            {
                OnSelectChanged(this, mod.data);
            }
            scrollY.ScrollView.gameObject.SetActive(false);
        }
Ejemplo n.º 2
0
        void ItemUpdate(PopItemMod g, object o, int index)
        {
            PopItemMod button = g as PopItemMod;

            if (button == null)
            {
                return;
            }

            if (button.Item != null)
            {
                var m = button.Item.Context.child[0];
                m.data.sizeDelta = new Vector2(ItemSize.x - 20, ItemSize.y - 10);
                m.IsChanged      = true;
            }
            if (button.Label != null)
            {
                var m = button.Label.model;
                m.data.sizeDelta = new Vector2(ItemSize.x - 20, ItemSize.y - 10);
                m.IsChanged      = true;
            }
            button.Index = index;
            button.data  = o;
            if (button.Item != null)
            {
                button.Item.DataContext = button;
                button.Item.Click       = ItemClick;
            }
            if (button.Label != null)
            {
                if (o is string)
                {
                    button.Label.text = o as string;
                }
                else
                {
                    button.Label.text = o.ToString();
                }
            }
            if (button.Checked != null)
            {
                if (index == SelectIndex)
                {
                    button.Checked.activeSelf = true;
                    Checked = button.Checked;
                }
                else
                {
                    button.Checked.activeSelf = false;
                }
            }
        }
Ejemplo n.º 3
0
        void ItemUpdate(object g, object o, int index)
        {
            PopItemMod button = g as PopItemMod;

            if (button == null)
            {
                return;
            }

            if (button.Item != null)
            {
                (button.Item.Target.GetChild(0) as RectTransform).sizeDelta = new Vector2(ItemSize.x - 20, ItemSize.y - 10);
            }
            if (button.Label != null)
            {
                button.Label.rectTransform.sizeDelta = new Vector2(ItemSize.x - 20, ItemSize.y - 10);
            }
            button.Index = index;
            button.data  = o;
            if (button.Item != null)
            {
                button.Item.DataContext = button;
                button.Item.Click       = ItemClick;
            }
            if (button.Label != null)
            {
                if (o is string)
                {
                    button.Label.text = o as string;
                }
                else
                {
                    button.Label.text = o.ToString();
                }
            }
            if (button.Checked != null)
            {
                if (index == SelectIndex)
                {
                    button.Checked.SetActive(true);
                    Checked = button.Checked;
                }
                else
                {
                    button.Checked.SetActive(false);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 项更新函数
        /// </summary>
        /// <param name="g">UI模型实例</param>
        /// <param name="o">数据实例</param>
        /// <param name="index">数据索引</param>
        public void ItemUpdate(PopItemMod g, object o, int index)
        {
            PopItemMod item = g;

            if (item == null)
            {
                return;
            }

            item.Index = index;
            item.data  = o;
            if (item.Item != null)
            {
                item.Item.DataContext = item;
                item.Item.Click       = ItemClick;
            }
            if (item.Text != null)
            {
                if (o is string)
                {
                    item.Text.Text = o as string;
                }
                else
                {
                    item.Text.Text = o.ToString();
                }
            }
            if (item.Check != null)
            {
                if (index == SelectIndex)
                {
                    item.Check.activeSelf = true;
                    Checked = item.Check;
                }
                else
                {
                    item.Check.activeSelf = false;
                }
            }
        }
Ejemplo n.º 5
0
        void ItemClick(UserEvent eventCall, UserAction action)
        {
            if (Checked != null)
            {
                Checked.activeSelf = false;
            }
            PopItemMod mod = eventCall.DataContext as PopItemMod;

            if (mod == null)
            {
                return;
            }
            if (mod.Check != null)
            {
                mod.Check.activeSelf = true;
                Checked = mod.Check;
            }
            SelectIndex = mod.Index;
            if (Label != null)
            {
                if (mod.data is string)
                {
                    Label.Text = mod.data as string;
                }
                else
                {
                    Label.Text = mod.data.ToString();
                }
            }
            if (OnSelectChanged != null)
            {
                OnSelectChanged(this, mod.data);
            }
            showAni  = -1;
            showTime = 0;
        }