Esempio n. 1
0
 public void Add(Control gump)
 {
     if (!gump.IsDisposed)
     {
         Gumps.Insert(0, gump);
         _needSort = true;
     }
 }
Esempio n. 2
0
        public void MakeTopMostGump(Control control)
        {
            Control c = control;

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

            for (int i = 1; i < Gumps.Count; i++)
            {
                if (Gumps[i] == c)
                {
                    Control cm = Gumps[i];
                    Gumps.RemoveAt(i);
                    Gumps.Insert(0, cm);
                    _needSort = true;
                }
            }
        }
Esempio n. 3
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;
            }
        }
Esempio n. 4
0
        public void MakeTopMostGumpOverAnother(Control control, Control overed)
        {
            Control c = control;

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

            Control c1 = overed;

            while (c1.Parent != null)
            {
                c1 = c1.Parent;
            }

            int index = 0;

            for (int i = Gumps.Count - 1; i >= 1; i--)
            {
                if (Gumps[i] == c)
                {
                    Control cm = Gumps[i];
                    Gumps.RemoveAt(i);

                    if (index == 0)
                    {
                        index = i;
                    }

                    Gumps.Insert(index - 1, cm);
                    _needSort = true;
                }
                else if (Gumps[i] == c1)
                {
                    index = i;
                }
            }
        }