Esempio n. 1
0
 public void ReversUpdate(WidgetCollection collection, Point startPoint)
 {
     for (int i = 0; i < collection.Count; i++)
     {
         Widget o = collection[i];
         o.SetFullPosition(startPoint + o.Position);
         o.Update(0.1f);
         if (o is Panel)
         {
             ReversUpdate(((Panel)o).Items, startPoint + o.Position);
         }
     }
 }
Esempio n. 2
0
 public Panel()
 {
     Items = new WidgetCollection(this);
 }
Esempio n. 3
0
 public GameUI()
 {
     Items          = new WidgetCollection(this);
     DrawebleSolver = new BasicResolver(this);
 }
Esempio n. 4
0
        public bool Process(Point fullpoint, int window_width, int window_height, int cur_x, int cur_y, bool cur_statel, /*byte* key_sate,*/ Widget parent = null, WidgetCollection Items = null)
        {
            bool CursorApot = false;

            if (parent == null)
            {
                parent = this;
            }
            if (Items == null)
            {
                Items = this.Items;
            }

            parent.Width  = window_width;
            parent.Height = window_height;

            fullpoint += parent.Position;


            for (int i = 0; i < Items.Count; i++)
            {
                Widget o = Items[i];

                o.CursorPosition = new Point(cur_x, cur_y);
                if (!o.IsVisable)
                {
                    continue;
                }

                if (o is Panel)
                {
                    CursorApot = CursorApot || this.Process(fullpoint, o.Width, o.Height, cur_x, cur_y, cur_statel, /*key_sate,*/ o, ((Panel)o).Items);
                }

                if (
                    !CursorCollusion(fullpoint + o.Position, fullpoint + o.PositionMax, new Point(cur_x, cur_y), new Point(cur_x, cur_y))
                    ||
                    !CursorCollusion(fullpoint, new Point(parent.Width, parent.Height) + fullpoint, new Point(cur_x, cur_y), new Point(cur_x, cur_y))
                    )
                {
                    if (o.IsMouseMove == true)
                    {
                        o.OnMouseLeave();
                    }
                    o.IsMouseMove = false;

                    if (o.IsMouseDown == true && !cur_statel)
                    {
                        o.IsMouseDown = false;
                        o.OnMouseUp();
                    }
                    else
                    {
                        continue;
                    }
                }

                if (CursorApot)
                {
                    continue;
                }

                CursorApot = true;

                if (o.IsMouseMove == false)
                {
                    o.OnMouseMove();
                }
                o.IsMouseMove = true;

                if (cur_statel)
                {
                    if (o.IsMouseDown == false)
                    {
                        Widget tmp = Items[0];
                        Items[0] = Items[i];
                        Items[i] = tmp;


                        o.OnMouseDown();
                        o.UI.Selected = o;
                    }

                    o.IsMouseDown = true;
                }
                else
                {
                    if (o.IsMouseDown == true)
                    {
                        o.OnMouseUp();
                    }
                    o.IsMouseDown = false;
                }
            }

            return(CursorApot);
        }