private void Init() { AvailableView = CreateChild("available", 0); { AvailableView.Anchor = AnchorType.Fill; AvailableView.Offset = Offset.Zero; metronomeDisplay = AvailableView.CreateChild <MetronomeDisplay>("metronome", 0); { metronomeDisplay.Anchor = AnchorType.CenterStretch; metronomeDisplay.X = 120f; metronomeDisplay.SetOffsetVertical(0f); metronomeDisplay.Width = 500f; } modeGrid = AvailableView.CreateChild <UguiGrid>("modes", 1); { modeGrid.Anchor = AnchorType.CenterStretch; modeGrid.X = -200f; modeGrid.SetOffsetVertical(0f); modeGrid.Width = 500f; modeGrid.Spacing = new Vector2(44f, 0f); modeGrid.Axis = GridLayoutGroup.Axis.Horizontal; modeGrid.Alignment = TextAnchor.MiddleCenter; fullMode = modeGrid.CreateChild <MetronomeMode>("full", 0); { fullMode.Frequency = BeatFrequency.Full; } halfMode = modeGrid.CreateChild <MetronomeMode>("half", 1); { halfMode.Frequency = BeatFrequency.Half; } } } UnavailableView = CreateChild("unavailable", 1); { UnavailableView.Anchor = AnchorType.Fill; UnavailableView.Offset = Offset.Zero; var message = UnavailableView.CreateChild <Label>("message", 0); { message.FontSize = 20; message.Anchor = AnchorType.Fill; message.Offset = Offset.Zero; message.Alignment = TextAnchor.MiddleCenter; message.Text = "Metronome currently unavailable."; } } InvokeAfterTransformed(2, () => { modeGrid.CellSize = new Vector2(68f, this.Height); }); OnEnableInited(); }
/// <summary> /// Adds a button that will switch the calendar to any of the Available Views to the stirng. /// </summary> /// <param name="availableView">Calendar view</param> /// <returns>Instance of the <see cref="ControlsBuilder"/></returns> public ControlsBuilder AddView(AvailableView availableView) { _buildedString += availableView.ToString().FirstCharToLower(); return(this); }