Ejemplo n.º 1
0
        public static void Update(double totalMS, double frameMS)
        {
            SortControlsByInfo();

            var first = Gumps.First;

            while (first != null)
            {
                var next = first.Next;

                Control g = first.Value;

                g.Update(totalMS, frameMS);

                if (g.IsDisposed)
                {
                    Gumps.Remove(first);
                }

                first = next;
            }

            GameCursor?.Update(totalMS, frameMS);
            HandleKeyboardInput();
            HandleMouseInput();
        }
Ejemplo n.º 2
0
 public void RemoveGump(Gump gump)
 {
     if (Gumps != null)
     {
         Gumps.Remove(gump);
     }
 }
Ejemplo n.º 3
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;
                }
            }
        }
Ejemplo n.º 4
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;
            }
        }
Ejemplo n.º 5
0
        public static void Update(double totalMS, double frameMS)
        {
            SortControlsByInfo();

            var first = Gumps.First;

            for (var right = first.Next; first != null; first = right, right = right?.Next)
            {
                Control g = first.Value;

                g.Update(totalMS, frameMS);

                if (g.IsDisposed)
                {
                    Gumps.Remove(first);
                }
            }

            GameCursor?.Update(totalMS, frameMS);
            HandleKeyboardInput();
            HandleMouseInput();
        }