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); } } }
public Panel() { Items = new WidgetCollection(this); }
public GameUI() { Items = new WidgetCollection(this); DrawebleSolver = new BasicResolver(this); }
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); }