void CustomInitialize() { _hudLayout = UiControlManager.Instance.CreateControl<SimpleLayout>(); _hudLayout.FullScreen = true; var scoreLayout = UiControlManager.Instance.CreateControl<BoxLayout>(); scoreLayout.CurrentDirection = BoxLayout.Direction.Right; scoreLayout.Spacing = 5; var label = UiControlManager.Instance.CreateControl<LayoutableText>(); label.DisplayText = "Moves: "; scoreLayout.AddItem(label); _moveCountText = UiControlManager.Instance.CreateControl<LayoutableText>(); _moveCountText.DisplayText = _lastMoveCountValue.ToString(); scoreLayout.AddItem(_moveCountText); _hudLayout.AddItem(scoreLayout, HorizontalPosition.OffsetFromCenter(0), VerticalPosition.OffsetFromTop(-10)); }
void CustomInitialize() { _mainLayout = UiControlManager.Instance.CreateControl<SimpleLayout>(); var grid = UiControlManager.Instance.CreateControl<GridLayout>(); grid.ShowBorder = true; grid.Margin = 20; grid.Spacing = 30; for (int row = 0; row < 5; row++) { for (int col = 0; col < 5; col++) { if (col == 2 && row == 2) { var circle = UiControlManager.Instance.CreateControl<CircularLayout>(); circle.StartingDegrees = 90; circle.Radius = 80; circle.CurrentArrangementMode = CircularLayout.ArrangementMode.EvenlySpaced; circle.ShowBorder = false; for (int x = 0; x < 5; x++) { var btn = CreateButton(); btn.Text = "#" + x; btn.ResizeAroundText(5, 5); circle.AddItem(btn); } grid.AddItem(circle, row, col, horizontalAlignment: GridLayout.HorizontalAlignment.Center, verticalAlignment: GridLayout.VerticalAlignment.Center); } else { var btn = CreateButton(); btn.Text = string.Format("Button {0} - {1}", row, col); btn.ResizeAroundText(10, 10); grid.AddItem(btn, row, col, horizontalAlignment: GridLayout.HorizontalAlignment.Center, verticalAlignment: GridLayout.VerticalAlignment.Center); } } } _mainLayout.FullScreen = true; _mainLayout.AddItem(grid, HorizontalPosition.PercentFromLeft(5), VerticalPosition.PercentFromTop(-5), LayoutOrigin.TopLeft); }