Example #1
0
 public static void Add(Control gump)
 {
     if (!gump.IsDisposed)
     {
         Gumps.AddFirst(gump);
         _needSort = true;
     }
 }
Example #2
0
        public static void MakeTopMostGump(Control control)
        {
            Control c = control;

            while (c.Parent != null)
                c = c.Parent;

            var first = Gumps.First?.Next; // skip game window

            for (; first != null; first = first.Next)
            {
                if (first.Value == c)
                {
                    Gumps.Remove(first);
                    Gumps.AddFirst(first);
                    _needSort = true;
                }
            }
        }
Example #3
0
        private static void SortControlsByInfo()
        {
            if (_needSort)
            {
                for (var el = Gumps.First; el != null; el = el.Next)
                {
                    var c = el.Value;

                    if (c.ControlInfo.Layer == UILayer.Default)
                    {
                        continue;
                    }

                    if (c.ControlInfo.Layer == UILayer.Under)
                    {
                        for (var first = Gumps.First; first != null; first = first.Next)
                        {
                            if (first.Value == c)
                            {
                                if (Gumps.Last != null)
                                {
                                    Gumps.Remove(first);
                                    Gumps.AddAfter(Gumps.Last, c);
                                }
                            }
                        }
                    }
                    else if (c.ControlInfo.Layer == UILayer.Over)
                    {
                        for (var first = Gumps.First; first != null; first = first.Next)
                        {
                            if (first.Value == c)
                            {
                                Gumps.Remove(first);
                                Gumps.AddFirst(c);
                            }
                        }
                    }
                }

                _needSort = false;
            }
        }