public override void Load() { base.Load(); OsuGame game = Game as OsuGame; Add(new Box() { SizeMode = InheritMode.XY, Size = new Vector2(1, 1), Colour = Color4.DarkRed }); ClickableBox button; Add(button = new ClickableBox(Color4.Pink) { Size = new Vector2(50, 50) }); button.Activated += () => ExitMode(); Add(container = new AutoSizeContainer() { Anchor = Anchor.Centre, Origin = Anchor.Centre }); container.Add(new ClickableBox(Color4.SkyBlue) { SizeMode = InheritMode.XY, Size = Vector2.One }); container.Add(new ClickableBox(Color4.Orange) { Size = new Vector2(50, 50), Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft }); container.Add(new ClickableBox(Color4.Orange) { Size = new Vector2(50, 50), Anchor = Anchor.TopRight, Origin = Anchor.TopRight }); container.Add(new ClickableBox(Color4.Orange) { Size = new Vector2(50, 50), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }); container.Add(new ClickableBox(Color4.Blue) { Size = new Vector2(10, 10), Anchor = Anchor.Centre, Origin = Anchor.Centre }); container.Add(new ClickableBox(Color4.Orange) { Size = new Vector2(50, 50), Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight }); container.Add(new SpriteCircular(game.Textures.Get("coin")) { Position = new Vector2(100), Origin = Anchor.Centre, Anchor = Anchor.Centre }); Add(new SpriteText(game.Textures) { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, Text = "12345" }); }
public override void Load() { base.Load(); Target.OnInvalidate += onInvalidate; AutoSizeContainer da = Target as AutoSizeContainer; if (da != null) { da.OnAutoSize += onAutoSize; } FlowContainer df = Target as FlowContainer; if (df != null) { df.OnLayout += onLayout; } activityAutosize = new Box { Colour = Color4.Red, Size = new Vector2(2, line_height), Position = new Vector2(0, 0), Alpha = 0 }; activityLayout = new Box { Colour = Color4.Orange, Size = new Vector2(2, line_height), Position = new Vector2(3, 0), Alpha = 0 }; activityInvalidate = new Box { Colour = Color4.Yellow, Size = new Vector2(2, line_height), Position = new Vector2(6, 0), Alpha = 0 }; var sprite = Target as Sprite; if (sprite?.Texture != null) { previewBox = new Sprite { Texture = sprite.Texture, Scale = new Vector2((float)sprite.Texture.Width / sprite.Texture.Height, 1) } } ; else { previewBox = new Box { Colour = Color4.White } }; previewBox.Position = new Vector2(9, 0); previewBox.Size = new Vector2(line_height, line_height); text = new SpriteText { Position = new Vector2(24, -3), Scale = new Vector2(0.9f), //FontFace = FontFace.FixedWidth }; Flow.Alpha = 1; Add(activityInvalidate); Add(activityLayout); Add(activityAutosize); Add(previewBox); Add(text); Add(Flow); updateSpecifics(); }