Пример #1
0
        private void SortControlsByInfo()
        {
            if (_needSort)
            {
                var gumps = Gumps.Where(s => s.ControlInfo.Layer != UILayer.Default).ToArray();

                int over  = 0;
                int under = Gumps.Count - 1;

                foreach (Control c in gumps)
                {
                    if (c.ControlInfo.Layer == UILayer.Under)
                    {
                        for (int i = 0; i < Gumps.Count; i++)
                        {
                            if (Gumps[i] == c)
                            {
                                Gumps.RemoveAt(i);
                                Gumps.Insert(under, c);
                            }
                        }
                    }
                    else if (c.ControlInfo.Layer == UILayer.Over)
                    {
                        for (int i = 0; i < Gumps.Count; i++)
                        {
                            if (Gumps[i] == c)
                            {
                                Gumps.RemoveAt(i);
                                Gumps.Insert(over++, c);
                            }
                        }
                    }
                }

                //_gumps.Sort((a, b) => a.ControlInfo.Layer.CompareTo(b.ControlInfo.Layer));
                _needSort = false;
            }
        }
Пример #2
0
        private Control GetMouseOverControl(Point position)
        {
            if (_isDraggingControl)
            {
                return(DraggingControl);
            }

            var controls = IsModalControlOpen ? Gumps.Where(s => s.ControlInfo.IsModal) : Gumps;

            Control[] mouseOverControls = null;

            foreach (Control c in controls)
            {
                Control[] ctrls = c.HitTest(position);

                if (ctrls != null)
                {
                    mouseOverControls = ctrls;

                    break;
                }
            }

            if (mouseOverControls != null)
            {
                foreach (Control t in mouseOverControls)
                {
                    if (t.AcceptMouseInput)
                    {
                        return(t);
                    }
                }
            }

            return(null);
        }
Пример #3
0
 public Control[] GetMouseOverControls(Point position)
 {
     return(Gumps.Where(o => o.HitTest(position) != null).ToArray());
 }